ShortBuffer.duplicate() has the following syntax.
public abstract ShortBuffer duplicate()
In the following code shows how to use ShortBuffer.duplicate() method.
//from w w w. ja v a2s. com import java.nio.ShortBuffer; import java.util.Arrays; public class Main { public static void main(String[] args) { ShortBuffer shortBuffer = ShortBuffer.allocate(10); shortBuffer.put((short)100); shortBuffer.rewind(); ShortBuffer shortBuffer2 = shortBuffer.duplicate(); System.out.println(shortBuffer2.equals(shortBuffer2)); } }
The code above generates the following result.