public static ByteBuffer allocate (int capacity)

Allocates a new byte buffer.

The new buffer's position will be zero, its limit will be its capacity, its mark will be undefined, and each of its elements will be initialized to zero. It will have a backing array, and its array offset will be zero.

Parameters:
capacity     The new buffer's capacity, in bytes

Returns:  The new byte buffer

Exceptions:
IllegalArgumentException     If the capacity is a negative integer