Convert a char to an int

eg.

char c = ‘A’;
int value = (char) c;

Following code demonstrates this. It prints out the ascii values of each letter
in a sentence:

public class Main
{
   public static void main(String args[]) {
      String s = "A woman doesn't have a banana";
 
      for (int i=0; i<s.length(); i++) {
         char c    = s.charAt(i);
         int value = (int) c;
 
         System.out.println(c + ": " + value);
      }
   }
}

prints out:

W: 87
o: 111
m: 109
e: 101
n: 110
 : 32
d: 100
o: 111
n: 110
': 39
t: 116
 : 32
h: 104
a: 97
v: 118
e: 101
 : 32
a: 97
 : 32
b: 98
a: 97
n: 110
a: 97
n: 110
a: 97