You will have to do some math magic to get the nth digit of an arbitrary number, basically using division and modulo 10 if you want it to be a number. Otherwise string ops will work.
int nth ( int number, int index ) {
return ((int)number / java.lang.Math.pow(10, index)) % 10;
}
char nth ( int number, int index ) {
return String.valueOf(java.lang.Math.abs(number)).charAt(index);
}
Mind you the modulo method will take form the right side and the string will take from the left;