Doubling size of 2d array
This post concerns doubling the size of a matrix. The method takes an int[][] as imput and outputs a new int[][] double in size.
Some of the code I have managed to write:
public static int[][] doubleSize(int[][] m) {
int[][] doubleSizeArray = new int[2 * m.length][2 * m[0].length];
for (int i=0, i < m.length; i++) {
for (int j=0; j < m[0].length; j++) {
doubleSizeArray[i][j] = m[i][j];
//i am at a loss as to what to do next
}
} //return statement
}
In the assignment question it is written: "every single value in the original matrix should be duplicated 3 additional times so that it is present 4 times in the new matrix". I don't know how to implement this in the java language. Any help would be greatly appreciated!