public void consume(double value){
  if (consumed == nextToTake) {
    data[next]=value;
    next++;
  }
  consumed++;
  if (consumed == blockSize) {
    if (next == size) {
      Arrays.sort(data);
    }
 else {
      consumed=0;
      if (blockSize > 1) {
        nextToTake=randomGenerator.nextLong(blockSize);
      }
    }
  }
}

public void consume ( double value ) { if ( consumed == nextToTake ) { data [ next ] = value ; next ++ ; } consumed ++ ; if ( consumed == blockSize ) { if ( next == size ) { Arrays . sort ( data ) ; } else { consumed = 0 ; if ( blockSize > 1 ) { nextToTake = randomGenerator . nextLong ( blockSize ) ; } } } }
consumes a value from the input stream . < p > for each 2 ^ level values consumed , one is added to the buffer . the buffer is not considered full until 2 ^ level * size values have been consumed . < p > sorts the data array if the consumption renders the buffer full .
