import java.nio.*; import java.nio.ShortBuffer; public class AllocateShort  {   public static final int capacity=256;   public static void main(String[] arg) {       ShortBuffer shortBuff = ShortBuffer.allocate(capacity);     shortBuff.put((short) 565);     shortBuff.flip();     System.out.println("Limit of short buffer : "                                   + shortBuff.limit());     System.out.println("capacity of short buffer : "                                + shortBuff.capacity());     while (shortBuff.hasRemaining())        {       System.out.println("Content in shortbuffer : "                                    + shortBuff.get());     }   } }