Here you can find the source of array2DTo1D(int[][] array2D)
public static int[] array2DTo1D(int[][] array2D)
//package com.java2s; /*/*from w ww. j a va2 s. 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[] array2DTo1D(int[][] array2D) { int[] array1D = new int[array2D[0].length * array2D.length]; for (int x = 0; x < array2D.length; x++) { for (int y = 0; y < array2D[0].length; y++) { array1D[(x * array2D.length) + y] = array2D[x][y]; } } return array1D; } }