store the digits in an array
digit . add ( new Integer ( n % 10 ) ) ; n /= 10 ; } Collections . reverse ( digit ) ; boolean flag = true ; n = digit . get ( 0 ) ; for ( int i = 1 ; i < digit . size ( ) ; i ++ ) {