Java ByteBuffer.getLong(int index)

Syntax

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

public abstract long getLong(int index)

Example

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


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

  public static void main(String[] args) {
    ByteBuffer bb = ByteBuffer.allocate(BSIZE);
    bb.asLongBuffer().put(99472342341142L);
    System.out.println(bb.getLong(0));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer