Example usage for java.nio ShortBuffer get

List of usage examples for java.nio ShortBuffer get

Introduction

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

Prototype

public ShortBuffer get(short[] dest, int off, int len) 

Source Link

Document

Reads shorts from the current position into the specified short array, starting from the specified offset, and increases the position by the number of shorts read.

Usage

From source file:Main.java

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

    bb.rewind();//from  w  w  w. java  2  s . c om

    short[] shortArray = new short[10];
    bb.get(shortArray, 0, 2);

    System.out.println(Arrays.toString(shortArray));

}