Home Tutorial Java Corejava Nio Place array of double in a buffer

 
 

Share on Google+Share on Google+
Place array of double in a buffer
Posted on: July 28, 2010 at 12:00 AM
Advertisement
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

Advertisement

Related Tags for Place array of double in a buffer:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 28, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com