private long createHash(char[] str, int end){
        long hash = 0;
        for (int i = 0 ; i <= end; i++) {
            hash += str[i]*Math.pow(prime,i);
        }
        return hash;
    }
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