This Java tip demonstrates a method of creating a ByteBuffer. Fixed capacity bufferes that hold byte values are known as ByteBuffer. There may be various ways of creating a ByteBuffer.

 // Create a ByteBuffer using a byte array
    byte[] bytes = new byte[10];
    ByteBuffer buffer = ByteBuffer.wrap(bytes);
    // Create a non-direct ByteBuffer with a 10 byte capacity
    // The underlying storage is a byte array.
    buffer = ByteBuffer.allocate(10);
    // Create a memory-mapped ByteBuffer with a 10 byte capacity.
    buffer = ByteBuffer.allocateDirect(10);