function to reverse the digits in the range i to j in ' num '
public static void reverse ( char [ ] num , int i , int j ) { while ( i < j ) { char temp = num [ i ] ; num [ i ] = num [ j ] ; num [ j ] = temp ; i ++ ; j -- ; } }