Working with Java Data Types
What this topic covers
Work with primitives and wrappers, applying operators, casting, and type promotion correctly. Use String and StringBuilder, and apply local variable type inference, including in lambda parameters.
How can you convert a digit character into its int value?
Subtract '0' from the character, because digit characters have consecutive codes. For example, '7' - '0' gives the int 7. This also lets you sum the digits of a very long number without building or parsing it as a number.