Java ShortBuffer.get(short[] dst)

Syntax

ShortBuffer.get(short[] dst) has the following syntax.

public ShortBuffer get(short[] dst)

Example

In the following code shows how to use ShortBuffer.get(short[] dst) method.


import java.nio.ShortBuffer;
import java.util.Arrays;
/*ww w  .  ja  v a 2  s . c  om*/
public class Main {
  public static void main(String[] args) {
    ShortBuffer bb = ShortBuffer.allocate(10);
    bb.put((short)100);
    
    bb.rewind();
    
    short[] shortArray = new short[10];
    bb.get(shortArray);
    
    System.out.println(Arrays.toString(shortArray));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer