package ru.sbulygin;

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

/**
 * Class ConvertList.
 *
 * @author ru.sbulygin.
 * @since 13.04.2017.
 * @version 1.0.
 */
public class ConvertList {

    /**
     * A method converts a two-dimensional array to an ArrayList.
     * @param array two-dimensional array.
     * @return collection ArrayList.
     */
    public List<Integer> toList(int[][] array) {
        List<Integer> arrayList = new ArrayList<>();
        for (int[] index : array) {
            for (int value : index) {
                arrayList.add(value);
            }
            return arrayList;
        }




    }
}

@@ -26,27 +26,84 @@
 ort 
-java.util.ArrayList
+sun.font.GlyphLayout;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Iterator
 ;%0Aim
@@ -638,24 +638,30 @@
       %7D%0A    
+    %7D%0A
         retu
@@ -678,26 +678,831 @@
 st;%0A
-        %7D%0A%0A%0A%0A%0A    %7D
+%0A    %7D%0A%0A    /**%0A     * Method converts an ArrayList into a two-dimensional array.%0A     * @param list collection.%0A     * @param rows the number of rows.%0A     * @return array.%0A     */%0A    public int%5B%5D%5B%5D toArray(List%3CInteger%3E list, int rows) %7B%0A        int length = list.size() / rows;%0A        if (list.size() %25 rows != 0) %7B%0A            length += 1;%0A        %7D%0A        int%5B%5D%5B%5D listArray = new int%5Brows%5D%5Blength%5D;%0A        Iterator%3CInteger%3E iterator = list.iterator();%0A        for (int row = 0; row != rows; row++) %7B%0A            for (int column = 0; column != length; column++) %7B%0A                if (iterator.hasNext()) %7B%0A                    listArray%5Brow%5D%5Bcolumn%5D = iterator.next();%0A                %7D else %7B%0A                    listArray%5Brow%5D%5Bcolumn%5D = 0;%0A                %7D%0A            %7D%0A        %7D%0A        return listArray;%0A%0A    %7D%0A
 %0A%7D%0A

Create method toArray #2