1 2 3 4 5 6 7 8 9 10 | 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 ; } } |