private boolean checkEqual(char str1[],int start1,int end1, char str2[],int start2,int end2){
        if(end1 - start1 != end2 - start2) {
            return false;
        }
        while(start1 <= end1 && start2 <= end2){
            if(str1[start1] != str2[start2]){
                return false;
            }
            start1++;
            start2++;
        }
        return true;
    }
Date 09/25/2014
@author Tushar Roy

Rabin Karp algorith for substring matching.

Time complexity in worst case O(n^2)(depends on hash function)
Space complexity O(1)

References
https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm
src/com/interview/string/RabinKarpSearch.java