static DurationUnit selectDurationUnitForDisplay(long durationInNanos) {
        if (durationInNanos < 10 * NANOS_IN_ONE_MICROSECOND) {
            return DurationUnit.NANOSECOND;
        } else if (durationInNanos < 10 * NANOS_IN_ONE_MILLISECOND) {
            return DurationUnit.MICROSECOND;
        } else if (durationInNanos < 10 * NANOS_IN_ONE_SECOND) {
            return DurationUnit.MILLISSECOND;
        } else {
            return DurationUnit.SECOND;
        }
    }
A collection of utility methods.

@author Ceki G&uuml;lc&uuml;
slf4j-ext/src/main/java/org/slf4j/profiler/Util.java