Sunday, December 29, 2013

Decimal to ASCII




Hi all,



I have been writing a class method that converts a decimal value into ASCII but I am really struggling with it.




public String counterValue(int value)




so if I input 52 then the output should be '4'



if I input 48 then the output should be '0'



if I input 50 then the output should be '2'




OK, so far I have managed to do this but:



if I input 152 then I am expecting 'ÿ' but instead I see a '~' and I can't understand why.



I used (char)152 which I expected to return ÿ



Can anybody help?







No comments:

Post a Comment