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;
// w  ww  .j  a  v  a2 s. 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.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer