code: public static final HllSketch heapify(final Memory srcMem) {
      final CurMode curMode = checkPreamble(srcMem);
      final HllSketch heapSketch;
      if (curMode == CurMode.HLL) {
        final TgtHllType tgtHllType = extractTgtHllType(srcMem);
        if (tgtHllType == TgtHllType.HLL_4) {
          heapSketch = new HllSketch(Hll4Array.heapify(srcMem));
        } else if (tgtHllType == TgtHllType.HLL_6) {
          heapSketch = new HllSketch(Hll6Array.heapify(srcMem));
        } else { //Hll_8
          heapSketch = new HllSketch(Hll8Array.heapify(srcMem));
        }
      } else if (curMode == CurMode.LIST) {
        heapSketch = new HllSketch(CouponList.heapifyList(srcMem));
      } else {
        heapSketch = new HllSketch(CouponHashSet.heapifySet(srcMem));
      }
      return heapSketch;
    }
docs: Heapify the given Memory, which must be a valid HllSketch image and may have data.
  @param srcMem the given Memory, which is read-only.
  @return an HllSketch on the java heap.