public static int[][] deep_copy(int M[][]){
  int[][] C=new int[M.length][];
  for (int i=0; i < C.length; i++) {
    C[i]=Arrays.copyOf(M[i],M[i].length);
  }
  return C;
}

public static int [ ] [ ] deep_copy ( int M [ ] [ ] ) { int [ ] [ ] C = new int [ M . length ] [ ] ; for ( int i = 0 ; i < C . length ; i ++ ) { C [ i ] = Arrays . copyOf ( M [ i ] , M [ i ] . length ) ; } return C ; }
deep copy - make a deep copy of m [ ] [ ] .
