May 05

If you have a hex value as a string and you need the ASCII character that corresponds to that value then you need to parse your string to get its value. Once you have its value it is a simple cast to convert it to an ASCII character

eg. 4A (hex) -> 74 (dec) -> ‘J’

// First parse the hext String

int value = Integer.parseInt(hexString, 16);

// Then cast it to a char

char c = (char) value;

written by objects \\ tags: , ,

Leave a Reply

You must be logged in to post a comment.