Here you can find the source of toMatrix(Collection
public static int[][] toMatrix(Collection<int[]> collection)
//package com.java2s; import java.util.Collection; public class Main { public static int[][] toMatrix(Collection<int[]> collection) { int[][] result = new int[collection.size()][]; int index = 0; for (int[] array : collection) { result[index++] = array;//from w w w. ja v a2 s. c om } return result; } }