Java tutorial
//package com.java2s; import java.util.Arrays; public class Main { public static int[][] deepCopy(int[][] arg) { int[][] copy = null; if (arg != null) { copy = new int[arg.length][]; for (int rowIndex = arg.length - 1; rowIndex >= 0; rowIndex--) copy[rowIndex] = Arrays.copyOf(arg[rowIndex], arg[rowIndex].length); } return copy; } }