The exception comes from while ( (S[rightIndex] >= pivot) && (c.compare(S[rightIndex], pivot)>=0)). The reason is that you never check the bounds. Change both loops to make sure they don't go out of bounds:
This will get rid of the exception, although now there will be an infinite loop. I didn't check why tet.
The Comparator class should be made generic (using Number as bound wildcard), or use Integer as parameter types. That way you don't need to cast all these values. Also, Integer implements Comparable<Integer> so you can change your compare method to this: