Have a look at the String and Character classes they have some useful methods.

For example you could use:

char result = num.charAt(pos);

to get the character at the given position and...