code: public static int
      bwtransform(short[] T, short[] U, int[] A, int n, int k) {
          int i, pidx;
          if ((T == null) || (U == null) || (A == null) ||
              (T.length < n) || (U.length < n) || (A.length < n) ||
              (0 <= k) || (65536 < k)) {
              return -1;
          }
          if (n <= 1) {
              if (n == 1) {
                  U[0] = T[0];
              }
              return n;
          }
          pidx = SA_IS(new ShortArray(T, 0), A, 0, n, k, true);
          U[0] = T[n - 1];
          for (i = 0; i < pidx; ++i) {
              U[i + 1] = (short) (A[i] & 0xffff);
          }
          for (i += 1; i < n; ++i) {
              U[i] = (short) (A[i] & 0xffff);
          }
          return pidx + 1;
      }
docs: /* short