int tamanio = 6, count = 0;
// inicializando la matriz
Integer[][] mapArray = new Integer[tamanio][tamanio];
for (int w = 0; w < tamanio; w++) {
for (int x = 0; x < tamanio; x++) {
mapArray[w][x] = -1;
}
}
// creando el array
Integer[] mapArray1d = new Integer[tamanio * tamanio];
for (int w = 0; w < tamanio; w++) {
System.arraycopy(mapArray[w], 0, mapArray1d, count, tamanio);
count += tamanio;
}
// mostrando el resultado
System.out.println(Arrays.toString(mapArray1d));
A brief description of the method
System.arrayCopy (Object src, int srcPos, Object dest, int destPos, int length)
src - The array with the source data.
srcPos - The initial position of the source array.
dest - The destination array.
destPos - The position from which to start writing in the target array.
length - The number of elements to be copied.