Java ByteBuffer.getLong()

Syntax

ByteBuffer.getLong() has the following syntax.

public abstract long getLong()

Example

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


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

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

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer