char character = name.charAt(0); // This gives the character 'a' int ascii = (int) character; // ascii is now 97.

Read more of this post