code: public static ReservoirLongsUnion heapify(final Memory srcMem) {
      Family.RESERVOIR_UNION.checkFamilyID(srcMem.getByte(FAMILY_BYTE));
  
      final int numPreLongs = extractPreLongs(srcMem);
      final int serVer = extractSerVer(srcMem);
      final boolean isEmpty = (extractFlags(srcMem) & EMPTY_FLAG_MASK) != 0;
      int maxK = extractMaxK(srcMem);
  
      final boolean preLongsEqMin = (numPreLongs == Family.RESERVOIR_UNION.getMinPreLongs());
      final boolean preLongsEqMax = (numPreLongs == Family.RESERVOIR_UNION.getMaxPreLongs());
  
      if (!preLongsEqMin & !preLongsEqMax) {
        throw new SketchesArgumentException("Possible corruption: Non-empty union with only "
            + Family.RESERVOIR_UNION.getMinPreLongs() + "preLongs");
      }
  
      if (serVer != SER_VER) {
        if (serVer == 1) {
          final short encMaxK = extractEncodedReservoirSize(srcMem);
          maxK = ReservoirSize.decodeValue(encMaxK);
        } else {
          throw new SketchesArgumentException(
                  "Possible Corruption: Ser Ver must be " + SER_VER + ": " + serVer);
        }
      }
  
      final ReservoirLongsUnion rlu = new ReservoirLongsUnion(maxK);
  
      if (!isEmpty) {
        final int preLongBytes = numPreLongs << 3;
        final Memory sketchMem =
            srcMem.region(preLongBytes, srcMem.getCapacity() - preLongBytes);
        rlu.update(sketchMem);
      }
  
      return rlu;
    }
docs: Instantiates a Union from Memory
  
  @param srcMem Memory object containing a serialized union
  @return A ReservoirLongsUnion created from the provided Memory