Java tutorial
import java.nio.LongBuffer; import java.util.Arrays; public class Main { public static void main(String[] args) { LongBuffer longBuffer = LongBuffer.allocate(10); longBuffer.put(100); longBuffer.rewind(); LongBuffer longBuffer2 = longBuffer.compact(); System.out.println(longBuffer2.compareTo(longBuffer2)); } }