Java IO Tutorial - 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  ww. j  a v  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.