Here you can find the source of toDoubleList(double[] array)
public static List<Double> toDoubleList(double[] array)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static List<Double> toDoubleList(double[] array) { List<Double> list = new ArrayList<Double>(array.length); for (double el : array) list.add(el);// w w w . java 2 s . co m return list; } public static double[] add(double[] array, double element) { return insert(array, element, array.length); } public static int[] add(int[] array, int element) { int[] newArr = new int[array.length + 1]; System.arraycopy(array, 0, newArr, 0, array.length); newArr[newArr.length - 1] = element; return newArr; } public static double[] insert(double[] array, double element, int position) { if (position < 0) position = 0; if (position >= array.length) position = array.length; double[] newArray = new double[array.length + 1]; System.arraycopy(array, 0, newArray, 0, position); newArray[position] = element; System.arraycopy(array, position, newArray, position + 1, array.length - position); return newArray; } }