Java LongBuffer.put(long[] src)

Syntax

LongBuffer.put(long[] src) has the following syntax.

public final LongBuffer put(long[] src)

Example

In the following code shows how to use LongBuffer.put(long[] src) method.


import java.nio.LongBuffer;
import java.util.Arrays;
//from  w w w.jav a  2s  .  c  o  m
public class Main {
  public static void main(String[] args) {
    LongBuffer bb = LongBuffer.allocate(10);
    bb.put(100L);
    
    bb.rewind();
    
    
    LongBuffer longBuffer2 = LongBuffer.allocate(10);
    
    longBuffer2.put(bb);
    
    System.out.println(Arrays.toString(longBuffer2.array()));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer