import java.nio.*; import java.nio.ShortBuffer; public class BufferToBuffer { public static void main(String[] arg) { short[] array = new short[] { 75, 33, 442, 23}; ShortBuffer shortBuf = ShortBuffer.wrap(array); ShortBuffer shortBuf1 = ShortBuffer.allocate(256); System.out.println("Transfer the content from one" + " short buffer into another short buffer."); System.out.println("Elements in this short buffer."); while (shortBuf.hasRemaining()) { System.out.print(shortBuf.get() + " "); } shortBuf.flip(); shortBuf1.put(shortBuf); shortBuf1.flip(); System.out.println(); System.out.println("Elements in another short buffer."); while (shortBuf1.hasRemaining()) { System.out.print(shortBuf1.get() + " "); } } }