import java.nio.ByteBuffer;
publicclass Main {
publicstaticvoid main(String[] argv) throws Exception {
// Create a ByteBuffer using a byte array
byte[] bytes = newbyte[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);
}
}