Here you can find the source of array1DTo2D(int[] array1D)
public static int[][] array1DTo2D(int[] array1D)
//package com.java2s; /*// w w w. j a va2s . c o m * Universidad Nacional de Colombia - Sede Bogot? * * * Christian Rodriguez - carodriguezb@unal.edu.co * * C?digo liberado bajo licencia Creative Commons 3.0 * http://creativecommons.org/licenses/by-nc-sa/3.0/ */ public class Main { public static int[][] array1DTo2D(int[] array1D) { int m = (int) Math.sqrt(array1D.length); int[][] array2D = new int[m][m]; for (int x = 0; x < array1D.length; x++) { int fila = (x / m); int columna = x % m; array2D[fila][columna] = array1D[x]; } return array2D; } }