public int nextClearBit(int index){
  int i=index >> 6;
  if (i >= wlen)   return -1;
  int subIndex=index & 0x3f;
  long word=~bits.get(i) >> subIndex;
  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;
}

public int nextClearBit ( int index ) { int i = index > > 6 ; if ( i >= wlen ) return - 1 ; int subIndex = index & 0x3f ; long word = ~ bits . get ( i ) > > subIndex ; 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 .
