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: , ,

Sep 23

By simply casting it to an int.


char c = 'A';
int value = (int) c; 

written by objects \\ tags: , ,

Sep 08

By simply casting the char to an int.

char c = 'A';
int asciiValue = (int) c;

written by objects \\ tags: , ,