public boolean isSubString(char str1[], char str2[]) {
        int index = 0;
        int curLen = 0;
        Map<Character, Integer> count = new HashMap<Character, Integer>();
        for (int i = 0; i < str1.length; i++) {
            incrementCount(str1[i], count);
        }
        Map<Character, Integer> currentCount = new HashMap<Character, Integer>();
        Map<Character, Integer> pos = new HashMap<Character, Integer>();
        while (index < str2.length) {
            if (containsAndUpdate(currentCount, count, str2[index], pos, index)) {
                index++;
                curLen++;
            } else {
                Integer p = pos.get(str2[index]);
                if (p != null) {
                    curLen = index - p;
                    index = p;
                } else {
                    index++;
                }
                currentCount.clear();
                pos.clear();
            }
            if (curLen == str1.length) {
                return true;
            }
        }
        return false;
    }
http://www.careercup.com/question?id=5389078581215232
Given two strings tells if anagram of first is substring of another
Keep map of characters in array1 and keep checking if array2 has these characters.
main string : a b a c a b b and looking for a a b b c when 3rd a is encountered
we move index to second a and start from there.

Another idea is to keep a sorted linklist of string in comparison. Whenever a new character
is to be added remove last character from linklist and add this new one.
src/com/interview/string/AnagramOfFirstAsSubstring.java