public class LetterToAlphabetPos { public static void main(String[] args) { char letter = 'Z'; System.out.println(letterToAlphabetPos(letter)); // returns 26 } private static int letterToAlphabetPos(char letter) { return Character.toUpperCase(letter) - 64; } }