Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static double[][] toArray(ArrayList<ArrayList<Double>> a) { int dataDimen = a.size(); double[][] res = new double[dataDimen][dataDimen]; for (int i = 0; i < dataDimen; i++) { for (int j = 0; j < dataDimen; j++) { res[i][j] = a.get(i).get(j); } } return res; } }