Java IO Tutorial - 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;
//from w w  w.  j a v a2 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.