char digit = (char)(tmp.charAt(i) – ‘0’);
In the ascii table, characters from
'9' are contiguous. So, if you know that
tmp.charAt(i) will return a character between
9, then subracting
0 will return the offset from zero, that is, the digit that that character represents.