List of usage examples for java.nio DoubleBuffer array
public final double[] array()
From source file:Main.java
public static void main(String[] args) { DoubleBuffer bb = DoubleBuffer.allocate(BSIZE); bb.put(new double[] { 98765, 12345 }, 0, 1); System.out.println(Arrays.toString(bb.array())); }
From source file:Main.java
/** * Creates a double array from the provided {@link DoubleBuffer}. * // w w w . jav a2 s. co m * @param buffer {@link DoubleBuffer} the data source. * @return double array containing the data of the buffer. */ public static double[] getDoubleArrayFromBuffer(DoubleBuffer buffer) { double[] array = null; if (buffer.hasArray()) { array = buffer.array(); } else { buffer.rewind(); array = new double[buffer.capacity()]; buffer.get(array); } return array; }