Click to See Complete Forum and Search --> : Dump the characters value in Hex


November 4th, 1999, 09:45 PM
Dear yours,

I am beginner in Java, and has a question. (May be it is stupid).

Suppose I have a char type variable say ch, and then want to dump the character value in Hex format, how can I do?

Thanks!

unicman
November 4th, 1999, 10:32 PM
If u have a variable of data-type 'char', u can typecast it to 'int' or 'long' and then using either Long or Integer class u can use 'toHexString' method to get the hex value of the character.

- UnicMan
http://members.tripod.com/unicman