Java IO Tutorial - Java ByteBuffer.getInt(int index)








Syntax

ByteBuffer.getInt(int index) has the following syntax.

public abstract int getInt(int index)

Example

In the following code shows how to use ByteBuffer.getInt(int index) method.

import java.nio.ByteBuffer;
/* ww w .j  a va 2s  .  com*/
public class Main {
  private static final int BSIZE = 1024;

  public static void main(String[] args) {
    ByteBuffer bb = ByteBuffer.allocate(BSIZE);
    bb.asIntBuffer().put(99471142);
    System.out.println(bb.getInt(0));
  }
}

The code above generates the following result.