public static <E> Map<E,int[][]> intTwoDArrayMapCopy(Map<E,int[][]> map) {
        Map<E,int[][]> copy = null;
        if (map instanceof HashMap<?,?>) {
            copy = new HashMap<E,int[][]>();
        } else if (map instanceof TreeMap<?,?>) {
            copy = new TreeMap<E,int[][]>();
        }
        for (E e : map.keySet()) {
            int[][] cts = map.get(e);
            int[][] cpy = new int[cts.length][];
            for (int i = 0; i < cts.length; i++) {
                if (cts[i] != null) {
                    cpy[i] = new int[cts[i].length];
                    System.arraycopy(cts[i],0,cpy[i],0,cts[i].length);
                }
            }
            copy.put(e,cpy);
        }
        return copy;
    }