code: public static <T> T[][] copyOf(final T[][] nums) {
          final int lengthY = Array.getLength(nums);
          int lengthX = 0;
          if (Array.getLength(nums) > 0) {
              lengthX = Array.getLength(nums[0]);
          }
          @SuppressWarnings("unchecked")
          final T[][] copy = (T[][]) Array.newInstance(nums.getClass().getComponentType().getComponentType(), lengthY,
                  lengthX);
          for (int i = 0; i < copy.length; i++) {
              @SuppressWarnings("unchecked")
              final T[] member = (T[]) Array.newInstance(nums[i].getClass().getComponentType(), nums[i].length);
              System.arraycopy(nums[i], 0, member, 0, nums[i].length);
              copy[i] = member;
          }
          return copy;
      }
docs: Make a copy for a 2D array
  
  @param nums
  @return