private int stringCompare(char str[],char subString[],int pos){
        int i=0;
        while(pos < str.length && i < subString.length && str[pos] == subString[i]){
            pos++;
            i++;
        }
        if(i == subString.length){
            return 0;
        }
        if(pos == str.length){
            return -1;
        }
        return str[pos] < subString[i] ? -1 : 1;  
    }
http://www.geeksforgeeks.org/suffix-array-set-1-introduction/
src/com/interview/suffixprefix/SuffixArray.java