code: public static int getCompactStorageBytes(final int k, final long n) {
      if (n == 0) { return 8; }
      final int metaPreLongs = DoublesSketch.MAX_PRELONGS + 2; //plus min, max
      return ((metaPreLongs + Util.computeRetainedItems(k, n)) << 3);
    }
docs: Returns the number of bytes a DoublesSketch would require to store in compact form
  given the values of <i>k</i> and <i>n</i>. The compact form is not updatable.
  @param k the size configuration parameter for the sketch
  @param n the number of items input into the sketch
  @return the number of bytes required to store this sketch in compact form.