code: long getPrimaryAfter(long p, int index, boolean isCompressible) {
          assert(p == (elements[index] & 0xffffff00L) || isEndOfPrimaryRange(elements[index + 1]));
          long q = elements[++index];
          int step;
          if((q & SEC_TER_DELTA_FLAG) == 0 && (step = (int)q & PRIMARY_STEP_MASK) != 0) {
              // Return the next primary in this range.
              if((p & 0xffff) == 0) {
                  return Collation.incTwoBytePrimaryByOffset(p, isCompressible, step);
              } else {
                  return Collation.incThreeBytePrimaryByOffset(p, isCompressible, step);
              }
          } else {
              // Return the next primary in the list.
              while((q & SEC_TER_DELTA_FLAG) != 0) {
                  q = elements[++index];
              }
              assert((q & PRIMARY_STEP_MASK) == 0);
              return q;
          }
      }
docs: Returns the primary weight after p where index=findPrimary(p).
  p must be at least the first root primary.