String conversion to integer format and vice versa in Java

My thoughts & learnings


Start number at…
If the first character is ‘-‘
Set the negative flag
Start scanning with the next character
For each character in the string
Multiply number by 10
Add (digit character – ‘0’) to number
If negative flag set
Negate number
Return number

View original post 1 more word