Example usage for java.nio IntBuffer compact

List of usage examples for java.nio IntBuffer compact

Introduction

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

Prototype

public abstract IntBuffer compact();

Source Link

Document

Compacts this int buffer.

Usage

From source file:Main.java

public static void main(String[] args) {
    IntBuffer intBuffer = IntBuffer.allocate(10);
    intBuffer.put(100);//from   w ww .  ja v a  2  s . co  m

    intBuffer.rewind();

    IntBuffer intBuffer2 = intBuffer.compact();

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

}

From source file:Main.java

public static void main(String[] args) {
    IntBuffer intBuffer = IntBuffer.allocate(10);
    intBuffer.put(100);//from  w  ww. j  av a2  s.c o  m

    intBuffer.rewind();

    IntBuffer intBuffer2 = intBuffer.compact();

    System.out.println(intBuffer2.equals(intBuffer2));

}