Here you can find the source of convertToArray(Collection
public static double[] convertToArray(Collection<Double> input)
//package com.java2s; import java.util.Collection; public class Main { public static double[] convertToArray(Collection<Double> input) { double[] result = new double[input.size()]; int count = 0; for (double d : input) { result[count++] = d;/* w w w. ja va2 s . co m*/ } return result; } }