AuditDurationImpl implements AuditDuration { public static String getStringDuration(final long difference) { long hours = difference / (minInHour * secInMin * msInSec); long minutes = difference / (secInMin * msInSec) % minInHour; long seconds = difference / msInSec % secInMin; long millis = difference % msInSec; try (Formatter formatter = new Formatter()) { formatter.format("%02d:%02d:%02d.%03d", Long.valueOf(hours), Long.valueOf(minutes), Long.valueOf(seconds), Long.valueOf(millis)); return formatter.toString(); } } private  AuditDurationImpl(); private  AuditDurationImpl(final long start, final long finish); @Override long getStart(); @Override long getFinish(); @Override long getDifference(); @XmlValue @Override String getDuration(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static String getStringDuration(final long difference); static AuditDuration sumDuration(Collection<AuditDuration> durations);  }
@Test public void testGetStringDuration() { long second = 1000; long minute = 60 * second; long hour = 60 * minute; assertEquals("00:00:00.000", AuditDurationImpl.getStringDuration(0)); assertEquals("01:23:45.678", AuditDurationImpl.getStringDuration(hour + 23 * minute + 45 * second + 678)); }