public static ByteBuffer generateDirectByteBuffer(int length) {
byte[] bytes = generateByteArray(length);
ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.length);
buffer.put(bytes);
buffer.flip();
return buffer;
}
public static ByteBuffer[] generateDirectByteBufferArray(int elements, int length) {
ByteBuffer[] byteBufferArray = new ByteBuffer[elements];