public static int[] rotationArray(CharSequence S) {
			int n = S.length();
			Integer[] order = new Integer[n];
			for (int i = 0; i < n; i++)
				order[i] = i;
			Arrays.sort(order,
					comparador);
			
			int[] sa = new int[n];
			int[] classes = new int[n];
			for (int i = 0; i < n; i++) {
				sa[i] = order[i];
				classes[i] = S.charAt(i);
			}
			for (int len = 1; len < n; len *= 2) {
				int[] c = classes.clone();
				for (int i = 0; i < n; i++)
					classes[sa[i]] = i > 0
							&& c[sa[i - 1]] == c[sa[i]]
							&& c[(sa[i - 1] + len / 2) % n] == c[(sa[i] + len / 2)
									% n] ? classes[sa[i - 1]] : i;
				int[] cnt = new int[n];
				for (int i = 0; i < n; i++)
					cnt[i] = i;
				int[] s = sa.clone();
				for (int i = 0; i < n; i++) {
					int s1 = (s[i] - len + n) % n;
					sa[cnt[classes[s1]]++] = s1;
				}
			}
			return sa;
		}