public static int nextSetBit(long[] v,int start){
  int wordindex=start >>> LONG_LOG2_SIZE;
  if (wordindex >= v.length) {
    return -1;
  }
  long cur=v[wordindex] & (LONG_ALL_BITS << start);
  for (; ; ) {
    if (cur != 0) {
      return (wordindex * Long.SIZE) + Long.numberOfTrailingZeros(cur);
    }
    wordindex++;
    if (wordindex == v.length) {
      return -1;
    }
    cur=v[wordindex];
  }
}

public static int nextSetBit ( long [ ] v , int start ) { int wordindex = start > > > LONG_LOG2_SIZE ; if ( wordindex >= v . length ) { return - 1 ; } long cur = v [ wordindex ] & ( LONG_ALL_BITS << start ) ; for ( ; ; ) { if ( cur != 0 ) { return ( wordindex * Long . SIZE ) + Long . numberOfTrailingZeros ( cur ) ; } wordindex ++ ; if ( wordindex == v . length ) { return - 1 ; } cur = v [ wordindex ] ; } }
find the next set bit .
