Here you can find the source of flatten2DArray(double[][] array)
public static double[] flatten2DArray(double[][] array)
//package com.java2s; //License from project: Apache License public class Main { public static double[] flatten2DArray(double[][] array) { int length = 0; for (double[] arr : array) { length += arr.length;/*from ww w. jav a 2 s . c om*/ } double[] flattenArray = new double[length]; int count = 0; for (double[] arr : array) { for (int j = 0; j < arr.length; j++) { flattenArray[count++] = arr[j]; } } return flattenArray; } }