Integer output in Java method not same as pre-converted char value.
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-05-25T03:38:27Z
Indexed on
2010/05/25
3:41 UTC
Read the original article
Hit count: 267
I'm trying to parse a simple text file in an integer method and then output an integer from such file so that other parts of the program can use it. For testing purposes it also displays the character value (9 in this case). The integer value for some reason is 57. I've also tried it with another part of the text file (which in that case should be 5, but is instead 53).
After looking at an ASCII chart, I see that 57 is the ASCII version of the "symbol" 9 and that 53 is the ASCII version of the "symbol" 5. Is there any simple way I can fix this? I'm getting kind of frustrated as I'm a Java newbie (I've mostly only used FreePascal before this).
© Stack Overflow or respective owner