### Question:
TimeDuration { public static Duration ofHertz(double hz) { if (hz <= 0.0) { throw new IllegalArgumentException("Frequency has to be greater than 0.0"); } return Duration.ofNanos((long) (1000000000.0 / hz)); } private  TimeDuration(); static Duration createDuration(long sec, int nanoSec); static Duration ofHours(double hour); static Duration ofMinutes(double min); static Duration ofSeconds(double sec); static Duration ofHertz(double hz); static int dividedBy(Duration dividendDuration, Duration divisorDuration); static double toSecondsDouble(Duration duration); static String toSecondString(Duration duration);  }### Answer:
@Test public void hz1() { Duration duration = TimeDuration.ofHertz(1.0); assertThat(duration.getNano(), equalTo(0)); assertThat(duration.getSeconds(), equalTo(1L)); }
@Test public void hz2() { Duration duration = TimeDuration.ofHertz(100.0); assertThat(duration.getNano(), equalTo(10000000)); assertThat(duration.getSeconds(), equalTo(0L)); }
@Test public void hz3() { Duration duration = TimeDuration.ofHertz(0.123456789); assertThat(duration.getNano(), equalTo(100000073)); assertThat(duration.getSeconds(), equalTo(8L)); }