数字转字母
public static void main(String[] args) {
Integer num = 26;
String up = (char) (num + 64) + ""; //转为大写字母Z
String low = (char) (num + 96) + ""; //转为小写字母z
System.out.println(up);
System.out.println(low);
}
字母转数字
public static void main(String[] args) {
String up = "B";
String low = "b";
Integer aa = up.getBytes()[0] - 64; //大写转数字
Integer bb = low.getBytes()[0] - 96; //小写转数字
System.out.println(aa); //结果为2
System.out.println(bb); //结果为2
}