Here you can find the source of cloneMatrix(int[][] matrix)
public static int[][] cloneMatrix(int[][] matrix)
//package com.java2s; //License from project: Open Source License public class Main { public static int[][] cloneMatrix(int[][] matrix) { int[][] clonedMatrix = new int[matrix.length][]; for (int i = 0; i < matrix.length; i++) { clonedMatrix[i] = matrix[i].clone(); }/*from w w w.j a va 2 s.c om*/ return clonedMatrix; } }