private static StringBuilder toString(StringBuilder dest, Accountable a, int depth) {
    for (int i = 1; i < depth; i++) {
      dest.append("    ");
    }

    if (depth > 0) {
      dest.append("|-- ");
    }

    dest.append(a.toString());
    dest.append(": ");
    dest.append(RamUsageEstimator.humanReadableUnits(a.ramBytesUsed()));
    dest.append(System.lineSeparator());

    for (Accountable child : a.getChildResources()) {
      toString(dest, child, depth + 1);
    }

    return dest;
  }
 /**
  * Augments an existing accountable with the provided description.
  *
  * <p>The resource description is constructed in this format: {@code description [toString()]}
  *
  * <p>This is a point-in-time type safe view: consumers will not be able to cast or manipulate the
  * resource in any way.
  */
 public static Accountable namedAccountable(String description, Accountable in) {
   return namedAccountable(
       description + " [" + in + "]", in.getChildResources(), in.ramBytesUsed());
 }