public static String getColumnByNum(int index){
if (index <= 0) {
try {
throw new Exception("Invalid parameter");
} catch (Exception e) {
e.printStackTrace();
}
}
index--;
String column = "";
do {
if (column.length() > 0) {
index--;
}
column = ((char) (index % 26 + (int) 'A')) + column;
index = (int) ((index - index % 26) / 26);
} while (index > 0);
return column;
}
if (index <= 0) {
try {
throw new Exception("Invalid parameter");
} catch (Exception e) {
e.printStackTrace();
}
}
index--;
String column = "";
do {
if (column.length() > 0) {
index--;
}
column = ((char) (index % 26 + (int) 'A')) + column;
index = (int) ((index - index % 26) / 26);
} while (index > 0);
return column;
}