Example usage for java.nio ShortBuffer compact

List of usage examples for java.nio ShortBuffer compact

Introduction

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

Prototype

public abstract ShortBuffer compact();

Source Link

Document

Compacts this short buffer.

Usage

From source file:Main.java

public static void main(String[] args) {
    ShortBuffer shortBuffer = ShortBuffer.allocate(10);
    shortBuffer.put((short) 100);

    shortBuffer.rewind();//from   w w w.  j a v a2s.  c o m

    ShortBuffer shortBuffer2 = shortBuffer.compact();

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

}

From source file:Main.java

public static void main(String[] args) {
    ShortBuffer shortBuffer = ShortBuffer.allocate(10);
    shortBuffer.put((short) 100);

    shortBuffer.rewind();/*from  w  w  w.  j a v  a 2s .  com*/

    ShortBuffer shortBuffer2 = shortBuffer.compact();

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

}

From source file:Main.java

public static void main(String[] args) {
    ShortBuffer shortBuffer = ShortBuffer.allocate(10);
    shortBuffer.put((short) 100);

    shortBuffer.rewind();//from w  w w.  j a v  a  2  s. c o  m

    ShortBuffer shortBuffer2 = shortBuffer.compact();

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

}