LongBuffer.slice() has the following syntax.
public abstract LongBuffer slice()
In the following code shows how to use LongBuffer.slice() method.
import java.nio.LongBuffer; import java.util.Arrays; /*from w w w . j a v a 2 s. co m*/ public class Main { public static void main(String[] args) { LongBuffer longBuffer = LongBuffer.allocate(10); longBuffer.put(100); longBuffer.rewind(); LongBuffer longBuffer2 = longBuffer.slice(); System.out.println(longBuffer2.equals(longBuffer2)); } }
The code above generates the following result.