package ru.matevosyan;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ConvertList {

    public List<Integer> convert (List<int[]> list) {
        Iterator iterator = list.listIterator();
        ArrayList<Integer> arrayList = new ArrayList<>();
        int[] arrList;
        while (iterator.hasNext()) {
            arrList = (int[]) iterator.next();
            for (int anArrList : arrList) {
                arrayList.add(anArrList);
            }
        }
        return arrayList;
    }

    public List<Integer> toList (int[][] array) {
        List<Integer> list = new ArrayList<>();
        for (int[] anArray : array) {
            for (int j = 0; j < array.length; j++) {
                list.add(anArray[j]);
            }
        }
        return list;
    }

    public int[][] toArray (List<Integer> list, int rows) {

        int column = list.size() % rows == 0 ? list.size() / rows : list.size() / rows + 1;

        int[][] array = new int[rows][column];

        Iterator<Integer> iterator = list.iterator();

        for (int j = 0; j < rows; j++) {
            for (int i = 0; i < column && iterator.hasNext(); i++) {
                array[j][i] = iterator.next();
            }

        }

        return  array;
    }

}

@@ -100,34 +100,344 @@
 t;%0A%0A
-public class ConvertList %7B
+/**%0A * ConvertList was created convert from array to list and backward.%0A * Created on 28.04.2017.%0A * @author Matevosyan Vardan%0A * @version 1.0%0A */%0A%0Apublic class ConvertList %7B%0A%0A    /**%0A     * convert method convert list of an array to an array list.%0A     * @param list list with array inside.%0A     * @return converted array list.%0A     */
 %0A%0A  
@@ -837,32 +837,198 @@
 rayList;%0A    %7D%0A%0A
+    /**%0A     * toList method convert two-dimensional array to an array list.%0A     * @param array two-dimensional array.%0A     * @return converted array list.%0A     */%0A%0A
     public List%3C
@@ -1286,24 +1286,208 @@
 ist;%0A    %7D%0A%0A
+    /**%0A     * Convert list to array with passing amount of rows.%0A     * @param list list that to be converted to array.%0A     * @param rows amount rows.%0A     * @return array.%0A     */%0A%0A
     public i

add javadoc