code: private int ssPartition(int PA, int first, int last, int depth) {
          int a, b;// SA pointer
          int t;
          for (a = first - 1, b = last; ; ) {
              for (; (++a < b) && ((SA[PA + SA[a]] + depth) >= (SA[PA + SA[a] + 1] + 1)); ) {
                  SA[a] = ~SA[a];
              }
              for (; (a < --b) && ((SA[PA + SA[b]] + depth) < (SA[PA + SA[b] + 1] + 1)); ) {
              }
              if (b <= a) {
                  break;
              }
              t = ~SA[b];
              SA[b] = SA[a];
              SA[a] = t;
          }
          if (first < a) {
              SA[first] = ~SA[first];
          }
          return a;
      }
docs: Binary partition for substrings.