public static Duration of (long amount, TemporalUnit unit)

Obtains a Duration representing an amount in the specified unit.

The parameters represent the two parts of a phrase like '6 Hours'. For example:

  Duration.of(3, SECONDS);
  Duration.of(465, HOURS);
 
Only a subset of units are accepted by this method. The unit must either have an exact duration or be ChronoUnit.DAYS which is treated as 24 hours. Other units throw an exception.

Parameters:
amount    the amount of the duration, measured in terms of the unit, positive or negative
unit    the unit that the duration is measured in, must have an exact duration, not null

Returns:  a Duration, not null

Exceptions:
DateTimeException    if the period unit has an estimated duration
ArithmeticException    if a numeric overflow occurs