code: public static int sortKeyPrefixArray(
        LongArray array,
        long startIndex,
        long numRecords,
        int startByteIndex,
        int endByteIndex,
        boolean desc,
        boolean signed) {
      assert startByteIndex >= 0 : "startByteIndex (" + startByteIndex + ") should >= 0";
      assert endByteIndex <= 7 : "endByteIndex (" + endByteIndex + ") should <= 7";
      assert endByteIndex > startByteIndex;
      assert numRecords * 4 <= array.size();
      long inIndex = startIndex;
      long outIndex = startIndex + numRecords * 2L;
      if (numRecords > 0) {
        long[][] counts = getKeyPrefixArrayCounts(
          array, startIndex, numRecords, startByteIndex, endByteIndex);
        for (int i = startByteIndex; i <= endByteIndex; i++) {
          if (counts[i] != null) {
            sortKeyPrefixArrayAtByte(
              array, numRecords, counts[i], i, inIndex, outIndex,
              desc, signed && i == endByteIndex);
            long tmp = inIndex;
            inIndex = outIndex;
            outIndex = tmp;
          }
        }
      }
      return Ints.checkedCast(inIndex);
    }
docs: Specialization of sort() for key-prefix arrays. In this type of array, each record consists
  of two longs, only the second of which is sorted on.
  
  @param startIndex starting index in the array to sort from. This parameter is not supported
  in the plain sort() implementation.