public int nextClearBit ( int index ) { int i = index >> 6 ; if ( i >= wlen ) return - 1 ; int subIndex = index & 0x3f ; // index within the word long word = ~ bits . get ( i ) >> subIndex ; // skip all the bits to the right of // index if ( word != 0 ) { return ( i << 6 ) + subIndex + Long . numberOfTrailingZeros ( word ) ; } while ( ++ i < wlen ) { word = ~ bits . get ( i ) ; if ( word != 0 ) { return ( i << 6 ) + Long . numberOfTrailingZeros ( word ) ; } } return - 1 ; }
Find the next clear bit in the bit set .