public long[] select(long rank,long[] dest,final int offset,final int length){
  if (length == 0)   return dest;
  long s=select(rank);
  dest[offset]=s;
  int curr=(int)(s / Long.SIZE);
  long window=bits[curr] & -1L << s;
  window&=window - 1;
  for (int i=1; i < length; i++) {
    while (window == 0)     window=bits[++curr];
    dest[offset + i]=curr * Long.SIZE + Long.numberOfTrailingZeros(window);
    window&=window - 1;
  }
  return dest;
}

public long [ ] select ( long rank , long [ ] dest , final int offset , final int length ) { if ( length == 0 ) return dest ; long s = select ( rank ) ; dest [ offset ] = s ; int curr = ( int ) ( s / Long . SIZE ) ; long window = bits [ curr ] & - 1L << s ; window &= window - 1 ; for ( int i = 1 ; i < length ; i ++ ) { while ( window == 0 ) window = bits [ ++ curr ] ; dest [ offset + i ] = curr * Long . SIZE + Long . numberOfTrailingZeros ( window ) ; window &= window - 1 ; } return dest ; }
performs a bulk select of consecutive ranks into a given array fragment .
