Java ShortBuffer.get()

Syntax

ShortBuffer.get() has the following syntax.

public abstract short get()

Example

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


import java.nio.ShortBuffer;
/*  w w w .  j a  va  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());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer