@Override
        public int compare(Integer i1, Integer i2) {
            while(i1 < str.length && i2 < str.length && str[i1] == str[i2]){
                i1++;
                i2++;
            }
            if(i2 == str.length && i1 == str.length){
                return 0;
            }
            else if(i1 == str.length){
                return -1;
            }else if(i2 == str.length){
                return 1;
            }else return str[i1] < str[i2] ? -1 : 1;
            
        }
http://www.geeksforgeeks.org/suffix-array-set-1-introduction/
src/com/interview/suffixprefix/SuffixArray.java