Loop to iterate over the digits of the number N
while ( n != 0 ) { int r = n % b ; n = n / b ; if ( m . containsKey ( r ) ) { m . put ( r , m . get ( r ) + 1 ) ; } else { m . put ( r , 1 ) ; } } int last = - 1 ;