docs: public static <T> VarOptItemsUnion<T> heapify(final Memory srcMem,
                                                  final ArrayOfItemsSerDe<T> serDe) {
      Family.VAROPT_UNION.checkFamilyID(srcMem.getByte(FAMILY_BYTE));
  
      long n = 0;
      double outerTauNum = 0.0;
      long outerTauDenom = 0;
  
      final int numPreLongs = extractPreLongs(srcMem);
      final int serVer = extractSerVer(srcMem);
      final boolean isEmpty = (extractFlags(srcMem) & EMPTY_FLAG_MASK) != 0;
      final int maxK = extractMaxK(srcMem);
      if (!isEmpty) {
        n = extractN(srcMem);
        outerTauNum = extractOuterTauNumerator(srcMem);
        outerTauDenom = extractOuterTauDenominator(srcMem);
      }
  
      if (serVer != SER_VER) {
        throw new SketchesArgumentException(
                "Possible Corruption: Ser Ver must be " + SER_VER + ": " + serVer);
      }
  
      final boolean preLongsEqMin = (numPreLongs == Family.VAROPT_UNION.getMinPreLongs());
      final boolean preLongsEqMax = (numPreLongs == Family.VAROPT_UNION.getMaxPreLongs());
  
      if (!preLongsEqMin && !preLongsEqMax) {
        throw new SketchesArgumentException("Possible corruption: Non-empty union with only "
                + Family.VAROPT_UNION.getMinPreLongs() + "preLongs");
      }
  
      final VarOptItemsUnion<T> viu = new VarOptItemsUnion<>(maxK);
  
      if (isEmpty) {
        viu.gadget_ = VarOptItemsSketch.newInstanceAsGadget(maxK);
      } else {
        viu.n_ = n;
        viu.outerTauNumer = outerTauNum;
        viu.outerTauDenom = outerTauDenom;
  
        final int preLongBytes = numPreLongs << 3;
        final Memory sketchMem = srcMem.region(preLongBytes, srcMem.getCapacity() - preLongBytes);
        viu.gadget_ = VarOptItemsSketch.heapify(sketchMem, serDe);
      }
  
      return viu;
    }