To convert
char
to int
in Java, do this: (int)charValue
.Here's how you do it:
char aChar = 'a';
int aCharAsInt = (int)aChar;
System.out.println(aChar); // a
System.out.println(aCharAsInt); // 97