public static Duration duration(TimeUnit unit, long amount) {
        Objects.requireNonNull(unit, "unit");
        switch (unit) {
            case NANOSECONDS:
                return Duration.ofNanos(amount);
            case MICROSECONDS:
                return Duration.ofNanos(TimeUnit.MICROSECONDS.toNanos(amount));
            case MILLISECONDS:
                return Duration.ofMillis(amount);
            case SECONDS:
                return Duration.ofSeconds(amount);
            case MINUTES:
                return Duration.ofMinutes(amount);
            case HOURS:
                return Duration.ofHours(amount);
            case DAYS:
                return Duration.ofDays(amount);
            default:
                throw new AssertionError("unknown time unit: " + unit);

        }
    }
Gets a {@link Duration} for a {@link TimeUnit} and amount.

@param unit the unit
@param amount the amount
@return the duration
helper/src/main/java/me/lucko/helper/time/Time.java