Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { private static void loadLayer(int width, int height, String[] values, ArrayList<ArrayList<Integer>> layer) { for (int i = 0; i < height; i++) { ArrayList<Integer> row = new ArrayList<>(); for (int j = 0; j < width; j++) { row.add(Integer.parseInt(values[width * i + j])); } layer.add(row); } } }