public class LetterIndexUtil {

public static final String[] LETTERS = {
"A", "B", "C", "D", "E",
"F", "G", "H", "I", "J",
"K", "L", "M", "N", "O",
"P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y",
"Z"
};
public static final String[] NUMBERS = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};

/**
* 获取字母索引
*
* @param letter
* @return
*/
public static int getLetterIndx(String letter) {
for (int i = 0; i < LETTERS.length; i++) {
if (LETTERS[i].equalsIgnoreCase(letter)) {
return i;
}
}
return -1;
}

public static void main(String[] args) {
System.out.println("getLetterIndx(\"Z\") = " + getLetterIndx("Z"));
}
}