docs: static HeapUpdateDoublesSketch heapifyInstance(final Memory srcMem) {
      final long memCapBytes = srcMem.getCapacity();
      if (memCapBytes < 8) {
        throw new SketchesArgumentException("Source Memory too small: " + memCapBytes + " < 8");
      }
  
      final int preLongs = extractPreLongs(srcMem);
      final int serVer = extractSerVer(srcMem);
      final int familyID = extractFamilyID(srcMem);
      final int flags = extractFlags(srcMem);
      final int k = extractK(srcMem);
  
      final boolean empty = (flags & EMPTY_FLAG_MASK) > 0; //Preamble flags empty state
      final long n = empty ? 0 : extractN(srcMem);
  
      //VALIDITY CHECKS
      DoublesUtil.checkDoublesSerVer(serVer, MIN_HEAP_DOUBLES_SER_VER);
      Util.checkHeapFlags(flags);
      checkPreLongsFlagsSerVer(flags, serVer, preLongs);
      Util.checkFamilyID(familyID);
  
      final HeapUpdateDoublesSketch hds = newInstance(k); //checks k
      if (empty) { return hds; }
  
      //Not empty, must have valid preamble + min, max, n.
      //Forward compatibility from SerVer = 1 :
      final boolean srcIsCompact = (serVer == 2) | ((flags & COMPACT_FLAG_MASK) > 0);
  
      checkHeapMemCapacity(k, n, srcIsCompact, serVer, memCapBytes);
  
      //set class members by computing them
      hds.n_ = n;
      final int combBufCap = computeCombinedBufferItemCapacity(k, n);
      hds.baseBufferCount_ = computeBaseBufferItems(k, n);
      hds.bitPattern_ = computeBitPattern(k, n);
      //Extract min, max, data from srcMem into Combined Buffer
      hds.srcMemoryToCombinedBuffer(srcMem, serVer, srcIsCompact, combBufCap);
      return hds;
    }