Example usage for java.nio LongBuffer compact

List of usage examples for java.nio LongBuffer compact

Introduction

In this page you can find the example usage for java.nio LongBuffer compact.

Prototype

public abstract LongBuffer compact();

Source Link

Document

Compacts this long buffer.

Usage

From source file:Main.java

public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);/*from   w  ww .  j a  v  a 2s.  c  o m*/

    longBuffer.rewind();

    LongBuffer longBuffer2 = longBuffer.compact();

    System.out.println(Arrays.toString(longBuffer2.array()));

}

From source file:Main.java

public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);/*w  w w . ja  v  a2s.co  m*/

    longBuffer.rewind();

    LongBuffer longBuffer2 = longBuffer.compact();

    System.out.println(longBuffer2.compareTo(longBuffer2));

}