import java.nio.*; import java.nio.ByteBuffer; public class BufferHasArray { public static final int size = 256; public static void main(String[] argv) throws Exception { byte[] bytes = new byte[size]; ByteBuffer bytebuf = ByteBuffer.wrap(bytes); boolean isDirect = bytebuf.hasArray(); if (isDirect) { System.out.println("ByteBuffer is based on array"); } else { System.out.println("ByteBuffer is not based on array"); } } }