docs: static final CompactSketch heapify2to3(final Memory srcMem, final long seed) {
      final int memCap = (int) srcMem.getCapacity();
  
      final short seedHash = Util.computeSeedHash(seed);
      final short memSeedHash = srcMem.getShort(SEED_HASH_SHORT);
      Util.checkSeedHashes(seedHash, memSeedHash);
  
      if (memCap == 8) { //return empty, theta = 1.0
        return HeapCompactOrderedSketch
            .compact(new long[0], true, seedHash, 0, Long.MAX_VALUE);
      }
  
      final int curCount = srcMem.getInt(RETAINED_ENTRIES_INT);
      //Note: curCount could be zero and theta < 1.0 and be empty or not-empty.
  
      final int mdLongs = srcMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F; //either 2 or 3
      final int reqBytesIn = (curCount + mdLongs) << 3;
      validateInputSize(reqBytesIn, memCap);
  
      final long thetaLong = (mdLongs < 3) ? Long.MAX_VALUE : srcMem.getLong(THETA_LONG);
      boolean empty = (srcMem.getByte(FLAGS_BYTE) & EMPTY_FLAG_MASK) != 0;
      empty = (curCount == 0) && (thetaLong == Long.MAX_VALUE); //force true
      final long[] compactOrderedCache = new long[curCount];
      srcMem.getLongArray(mdLongs << 3, compactOrderedCache, 0, curCount);
      return HeapCompactOrderedSketch
          .compact(compactOrderedCache, empty, seedHash, curCount, thetaLong);
    }