copy array in java 2d code example Example: copy array in java 2d int[][] copy = Arrays.stream(matrix).map(int[]::clone).toArray(int[][]::new);