How about something simple?
public static int getLetterValue(char letter) { return (int) Character.toUpperCase(letter) - 64; }
and use it like this:
System.out.println(a[getLetterValue('a'));
It will be very difficult, as it stands at the moment. You will need to check it within range, etc.
Alternatively, you can implement the Java list interface and override the .get and .add methods so that they can use characters. But that brings me to the next point.
It is better to use a data structure that handles exceptions better and is designed for this kind of use. A Map is a much better choice.
source share