### Question:
ConvertList { public int[][] toArray(List<Integer> list, int rows) { int rowLength = (int) Math.ceil(list.size() / (double) rows); int[][] result = new int[rows][rowLength]; int rowsNumber = 0; int rowsPosition = 0; for (int element : list) { if (rowsPosition < rowLength) { result[rowsNumber][rowsPosition++] = element; } else if (rowsNumber < rows - 1) { rowsPosition = 0; result[++rowsNumber][rowsPosition++] = element; } } if (list.size() % rows != 0) { while (rowsPosition < rowLength) { result[rows - 1][rowsPosition++] = 0; } } return result; }  List<Integer> toList(int[][] array); int[][] toArray(List<Integer> list, int rows); List<Integer> convert(List<int[]> list);  }### Answer:
@Test public void convertArrayListToTwoDimensionalArray() { ConvertList testConvert = new ConvertList(); int[][] result = testConvert.toArray(new ArrayList<>(asList(1, 2, 3, 4, 5, 6, 7)), 3); int[][] expect = new int[][]{ {1, 2, 3}, {4, 5, 6}, {7, 0, 0} }; assertThat(result, is(expect)); }