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








Syntax

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

public DoubleBuffer put(DoubleBuffer src)

Example

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

import java.nio.DoubleBuffer;
import java.util.Arrays;
/*from w ww .  j  a va 2 s .co m*/
public class Main {
  private static final int BSIZE = 1024;

  public static void main(String[] args) {
    DoubleBuffer bb = DoubleBuffer.allocate(BSIZE);

    bb.put(98765);
    
    DoubleBuffer bb1 = DoubleBuffer.allocate(BSIZE);
    
    bb1.put(bb);
    
    System.out.println(Arrays.toString(bb1.array()));

    
  }
}

The code above generates the following result.