public static <E> Map<E,int[]> intArrayMapCopy(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];
            System.arraycopy(cts,0,cpy,0,cts.length);
            copy.put(e,cpy);
        }
        return copy;
    }