Makes a heap with the elements [0, size) of q

@param q The quicksortable to transform into a heap.
@param size The size of the quicksortable.
356927
public static void makeHeap(Quicksortable q, int size) {
        for (int i = (size-1)/2; i >= 0; i--) {
            heapifyDown(q, i, size);
        }
    }
472610
private static void sortheap(Quicksortable q, int size) {
        for (int i = size-1; i >= 1; i--) {
            q.swap(0, i);
            heapifyDown(q, 0, i);
        }
    }
581836
public static Buffer getQueue(int size) {

        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(
                Messages.get().getBundle().key(Messages.INIT_PUBLISH_HISTORY_SIZE_SET_1, new Integer(size)));
        }

        return BufferUtils.synchronizedBuffer(TypedBuffer.decorate(new CircularFifoBuffer(size) {

            /** The serialization version id constant. */
            private static final long serialVersionUID = -6257542123241183114L;

            /**
             * Called when the queue is full to remove the oldest element.<p>
             *
             * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove()
             */
            @Override
            public Object remove() {

                CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)super.remove();
                try {
                    OpenCms.getPublishManager().getEngine().getPublishHistory().remove(publishJob);
                } catch (CmsException exc) {
                    if (LOG.isErrorEnabled()) {
                        LOG.error(exc.getLocalizedMessage(), exc);
                    }
                }
                return publishJob;
            }
        }, CmsPublishJobInfoBean.class));
    }
21143
public static <K, V> Map<K, V> newLinkedHashMap(int size) {
    return new LinkedHashMap<K, V>(size);
  }
664955
public static byte[] fold(byte[] bytes, int size) {
        byte[] r = new byte[size];
        for (int i=Math.max(bytes.length,size)-1; i>=0; i-- ) {
            r[i%r.length] ^= bytes[i%bytes.length];
        }
        return r;
    }
145025
@SuppressWarnings("unchecked")
    public static ByteBuffer allocateDirectBuffer(int size) {
        try {
            Class<?> cls = Class.forName("java.nio.DirectByteBuffer");
            Constructor<?> constructor = cls.getDeclaredConstructor(Long.TYPE, Integer.TYPE);
            constructor.setAccessible(true);
            Field cleanerField = cls.getDeclaredField("cleaner");
            cleanerField.setAccessible(true);
            final long memory = allocateMemory(size);
            ByteBuffer buffer = (ByteBuffer) constructor.newInstance(memory, size);
            Cleaner cleaner = Cleaner.create(buffer, new Runnable() {
                @Override
                public void run() {
                    freeMemory(memory);
                }
            });
            cleanerField.set(buffer, cleaner);
            return buffer;
        } catch (Exception e) {
            throwException(e);
        }
        throw new IllegalStateException("unreachable");
    }
19358
public int alloc(int size) {
        int index = n;
        int len = array.length;
        if (n + size >= len) {
            byte[] aux = new byte[len + blockSize];
            System.arraycopy(array, 0, aux, 0, len);
            array = aux;
        }
        n += size;
        return index;
    }
1002078
protected byte[] ensureBufferSize(final int size, final Context context){
        if ((context.buffer == null) || (context.buffer.length < context.pos + size)){
            return resizeBuffer(context);
        }
        return context.buffer;
    }
563485
public static <E extends Comparable<E>> void quickSort(List<E> array) {
    if (array.isEmpty()) {
      return;
    }
    recursiveQuickSort(array, 0, array.size() - 1);
  }
656500
public static AreaL area(final AreaSizeL size)
  {
    Objects.requireNonNull(size, "Size");
    return AreaL.of(0L, size.sizeX(), 0L, size.sizeY());
  }
199244
def chunk(self, size):
        
        chunks = self._chunk(size)

        return self.__class__(list(map(self.__class__, chunks)))
91379
public static void topK(Quicksortable qs, int totalSize, int k) {
        if (k > totalSize) k = totalSize;
        makeHeap(qs, k);
        for (int i = k; i < totalSize; i++) {
            // compare each element to the root of the heap
            if (qs.compare(i, 0) > 0) {
                // if it's greater, swap it out and push it down
                qs.swap(0, i);
                heapifyDown(qs, 0, k);
            }
        }
        sort(qs, k);
        reverse(qs, k);
    }
299338
public static <K,V> Cache<K,V> newHardMemoryCache(int size) {
        return new MemoryCache<>(false, size);
    }
244553
public void truncate(int size) {

        m_buffer.truncate(size);
        m_position = Math.min(size, m_position);
    }
105844
public Cell<C,T> minSize (Value<C,T> size) {
		minWidth = size;
		minHeight = size;
		return this;
	}
333234
public static <T extends Comparable<? super T>> void quicksort( T[] arr )
    {
        quicksort( arr, 0, arr.length - 1 );
    }
758025
private void resizeBuf(int size)
    {
        int capacity;
        if (size >= _capacity * 2)
        {
            capacity = size;
        }
        else
        {
            capacity = 1;
            while (capacity < size)
            {
                capacity <<= 1;
            }
        }
        byte[] buf = new byte[capacity];
        if (_size > 0)
        {
            System.arraycopy(_buf, 0, buf, 0, _size);
        }
        _buf = buf;
        _capacity = capacity;
    }