Java IO Tutorial - Java IntBuffer.put(IntBuffer src)








Syntax

IntBuffer.put(IntBuffer src) has the following syntax.

public IntBuffer put(IntBuffer src)

Example

In the following code shows how to use IntBuffer.put(IntBuffer src) method.

import java.nio.IntBuffer;
import java.util.Arrays;
//from w ww. j  av a2s  .c  o m
public class Main {
  public static void main(String[] args) {
    IntBuffer bb = IntBuffer.allocate(10);
    bb.put(100);
    
    bb.rewind();
    
    
    IntBuffer intBuffer2 = IntBuffer.allocate(10);
    
    intBuffer2.put(bb);
    
    System.out.println(Arrays.toString(intBuffer2.array()));

  }
}

The code above generates the following result.