@SuppressWarnings("unchecked") private T[] combinedBufferToItemsArray(boolean ordered){
  T[] outArr=null;
  final int extra=2;
  final int outArrCap=getRetainedItems();
  outArr=(T[])Array.newInstance(minValue_.getClass(),outArrCap + extra);
  outArr[0]=minValue_;
  outArr[1]=maxValue_;
  System.arraycopy(combinedBuffer_,0,outArr,extra,baseBufferCount_);
  long bits=bitPattern_;
  if (bits > 0) {
    int index=extra + baseBufferCount_;
    for (int level=0; bits != 0L; level++, bits>>>=1) {
      if ((bits & 1L) > 0L) {
        System.arraycopy(combinedBuffer_,(2 + level) * k_,outArr,index,k_);
        index+=k_;
      }
    }
  }
  if (ordered) {
    Arrays.sort(outArr,extra,baseBufferCount_ + extra,comparator_);
  }
  return outArr;
}

@ SuppressWarnings ( "unchecked" ) private T [ ] combinedBufferToItemsArray ( boolean ordered ) { T [ ] outArr = null ; final int extra = 2 ; final int outArrCap = getRetainedItems ( ) ; outArr = ( T [ ] ) Array . newInstance ( minValue_ . getClass ( ) , outArrCap + extra ) ; outArr [ 0 ] = minValue_ ; outArr [ 1 ] = maxValue_ ; System . arraycopy ( combinedBuffer_ , 0 , outArr , extra , baseBufferCount_ ) ; long bits = bitPattern_ ; if ( bits > 0 ) { int index = extra + baseBufferCount_ ; for ( int level = 0 ; bits != 0L ; level ++ , bits >>>= 1 ) { if ( ( bits & 1L ) > 0L ) { System . arraycopy ( combinedBuffer_ , ( 2 + level ) * k_ , outArr , index , k_ ) ; index += k_ ; } } } if ( ordered ) { Arrays . sort ( outArr , extra , baseBufferCount_ + extra , comparator_ ) ; } return outArr ; }
returns an array of items in compact form , including min and max extracted from the combined buffer .
