Iterate from bset . _Find_first ( ) to bset . size ( ) - 1
for ( int i = bset . nextSetBit ( 0 ) ; i >= 0 ; i = bset . nextSetBit ( i + 1 ) ) { if ( i + 1 > len ) break ; System . out . println ( i + 1 ) ; } }