Here you can find the source of flatten(double[][] array)
public static double[] flatten(double[][] array)
//package com.java2s; public class Main { public static double[] flatten(double[][] array) { int size = 0; for (double[] a : array) { size += a.length;//w ww . j a v a 2s. c om } double[] newArray = new double[size]; int i = 0; for (double[] a : array) { for (double d : a) { newArray[i++] = d; } } return newArray; } }