import java.nio.*; import java.nio.ByteBuffer; import java.nio.ShortBuffer; public class DirectShortBuffer { public static void main(String[] arg) { short[] array = new short[] { 1, 2, 3, 4, 5 }; ShortBuffer shortBuf1 = ShortBuffer.wrap(array); if (shortBuf1.isDirect()) { System.out.println("Short buffer is direct."); } else { System.out.println("Short buffer is not direct."); } ByteBuffer b = ByteBuffer.allocateDirect(512); ShortBuffer shortBuf = b.asShortBuffer(); if (shortBuf.isDirect()) { System.out.println("Short buffer is direct."); } else { System.out.println("Short buffer is not direct."); } } }