How to convert letter char to its alphabet integer position in Java

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;
    }
}