// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class TwoDimClone {
   public static void main(String[] args) throws Exception {
      int[] one = new int[]{5,5};
      int[] oneClone = (int[])one.clone();
      one[1]=0;
      System.out.println(oneClone[1]);
      int[][] two = new int[][]{{5,5,5},{5,5,5},{5,5,5}};
      int[][] twoClone = (int[][])two.clone();
      two[1][1] = 0;
      System.out.println(twoClone[1][1]);
      int[][] three = new int[][]{{5,5,5},{5,5,5},{5,5,5}};
      int[][] threeClone = new int[three.length][];
      for(int i = 0; i < threeClone.length; i++) {
         threeClone[i] = (int[])three[i].clone();
      }
      three[1][1] = 0;
      System.out.println(threeClone[1][1]);
   }
}
