Java ShortBuffer.get(int index)

Syntax

ShortBuffer.get(int index) has the following syntax.

public abstract short get(int index)

Example

In the following code shows how to use ShortBuffer.get(int index) method.


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

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer