Since Java 8, using the streams API:
int[][] copy = Arrays.stream(matrix).map(int[]::clone).toArray(int[][]::new);
More Related Contents:
- How do I do a deep copy of a 2d array in Java?
- I am attempting write a class that multiplies two matrices using arrays. Are there any errors in the code? [closed]
- How to put one dimensional array in 2d array java
- Make copy of an array
- The best way to print a Java 2D array? [closed]
- Java Comparator class to sort arrays
- How to convert a 1d array to 2d array?
- Sorting 2D array of strings in Java
- Getting the array length of a 2D array in Java
- How do I create a jagged 2d array in Java?
- Arrays.fill with multidimensional array in Java
- Deep copy of an object array
- Java: Multi-dimensional array vs. one-dimensional
- Arrays constants can only be used in initializers error
- Pascal’s triangle 2d array – formatting printed output
- Arrays with trailing commas inside an array initializer in Java
- Multi-dimensional array transposing
- Is it possible to dynamically build a multi-dimensional array in Java?
- casting Arrays.asList causing exception: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList
- Iterate through 2 dimensional array
- Matrix multiplication using arrays
- How to deep copy an irregular 2D array
- Printing out a 2D array in matrix format
- Find elements surrounding an element in an array
- Write a program that takes an array/arraylist of integer and finds longest sub array/arraylist whose entries are equal [closed]
- How to add two int array values together?
- Find the most popular element in int[] array
- Write a mode method in Java to find the most frequently occurring element in an array
- Copying a HashMap in Java
- Error of int cannot be dereferenced?