Java IO Tutorial - 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 w w. j ava2 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.