import java.nio.*; import java.nio.ShortBuffer; public class StateString { public static final int index = 2; public static void main(String[] arg) { ShortBuffer shortBuff = ShortBuffer.allocate(1024); shortBuff.put((short) 2775); shortBuff.put((short) 7653); System.out.println("Position of short buffer : "+shortBuff.position()); System.out.println("Limit of short buffer : "+shortBuff.limit()); System.out.println("capacity of short buffer : "+shortBuff.capacity()); System.out.println("String representation of"+" state of short buffer : "); System.out.println(shortBuff.toString()); } }