public static int previousSetBit(long[] v,int start){
  if (start == -1) {
    return -1;
  }
  int wordindex=start >>> LONG_LOG2_SIZE;
  if (wordindex >= v.length) {
    return magnitude(v) - 1;
  }
  final int off=Long.SIZE - 1 - (start & LONG_LOG2_MASK);
  long cur=v[wordindex] & (LONG_ALL_BITS >>> off);
  for (; ; ) {
    if (cur != 0) {
      return (wordindex + 1) * Long.SIZE - 1 - Long.numberOfLeadingZeros(cur);
    }
    if (wordindex == 0) {
      return -1;
    }
    wordindex--;
    cur=v[wordindex];
  }
}

public static int previousSetBit ( long [ ] v , int start ) { if ( start == - 1 ) { return - 1 ; } int wordindex = start > > > LONG_LOG2_SIZE ; if ( wordindex >= v . length ) { return magnitude ( v ) - 1 ; } final int off = Long . SIZE - 1 - ( start & LONG_LOG2_MASK ) ; long cur = v [ wordindex ] & ( LONG_ALL_BITS > > > off ) ; for ( ; ; ) { if ( cur != 0 ) { return ( wordindex + 1 ) * Long . SIZE - 1 - Long . numberOfLeadingZeros ( cur ) ; } if ( wordindex == 0 ) { return - 1 ; } wordindex -- ; cur = v [ wordindex ] ; } }
find the previous set bit .
