I'm trying to create a copy of a multi-dimensional array such that any modification to the new array will not affect the original array.
Here is my code:
public static int[][] getNextGenUniverse(int[][] validUniverse) {
    // Create a copy of the original array
    int[][] nextUniverse = new validUniverse[][];
    // Iterate through all the elements of the array
    for (int i = 0; i < nextUniverse.length; i++) {
      // Iterate through all the elements of the subarrays
      for (int j = 0; j < nextUniverse[i].length; j++) {
      nextUniverse[i][j] = validUniverse[i][j];
      }
    }
}
I'm having trouble declaring the length of the new array. Could someone help me please?
 
    