Java LongBuffer.wrap(long[] array, int offset, int length)

Syntax

LongBuffer.wrap(long[] array, int offset, int length) has the following syntax.

public static LongBuffer wrap(long[] array,  int offset,  int length)

Example

In the following code shows how to use LongBuffer.wrap(long[] array, int offset, int length) method.


import java.nio.LongBuffer;
import java.util.Arrays;
/*w  w w.j a  v  a2s.  co m*/
public class Main {
  public static void main(String[] args) {
    LongBuffer bb = LongBuffer.wrap(new long[] { 0, 1, 2, 3, 4, 5, 6 },0,3);
    bb.put(100L);
    System.out.println(Arrays.toString(bb.array()));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer