Place array of double in a buffer


 

Place array of double in a buffer

In this tutorial you will see how to place array of double in buffer.

In this tutorial you will see how to place array of double in buffer.

Place array of double in a buffer

In this tutorial you will see how to place array of double in buffer. The put method of DoubleBuffer class transfers the entire content of the given source double array into a buffer.

Code:

import java.nio.DoubleBuffer;

public class DoubleBufferDemo {
  public static void main(String[] args) {
    double[] d = new double[] { 121.323232332353.4432.45453.756 };
    DoubleBuffer doublebuffer = DoubleBuffer.allocate(5);
    doublebuffer.put(d);
    System.out.println(doublebuffer.get(2));
  }
}

Output:

  32353.4

Download this code

Ads