### Question:
DateUtils { public static String formatDuration(long millis) { long days = 0; int hours = 0; int minutes = 0; int seconds = 0; if (millis >= MS_PER_DAY) { days = millis / MS_PER_DAY; millis = millis % MS_PER_DAY; } if (millis >= MS_PER_HOUR) { hours = (int) (millis / MS_PER_HOUR); millis = millis % MS_PER_HOUR; } if (millis >= MS_PER_MIN) { minutes = (int) (millis / MS_PER_MIN); millis = millis % MS_PER_MIN; } if (millis >= MS_PER_SEC) { seconds = (int) (millis / MS_PER_SEC); millis = millis % MS_PER_SEC; } StringBuilder sb = new StringBuilder(); if (days > 0) { sb.append(Long.toString(days)).append(" days, "); } if (sb.length() > 0 || hours > 0) { sb.append(Integer.toString(hours)).append(" hours, "); } if (sb.length() > 0 || minutes > 0) { sb.append(Integer.toString(minutes)).append(" mins, "); } sb.append(Integer.toString(seconds)).append(" secs"); return sb.toString(); }  static List<Date> getHolidays(int year); static boolean isHoliday(Date date); static Date getNormalizedToday(); static Date normalizeDate(Date date); static boolean isHoliday(Calendar cal); static boolean isWeekend(Calendar cal); static String formatDate(Date date); static String getTimeNow(); static Date getDate(int year, int month, int day); static int getDaysBetween(Date date1, Date date2); static String formatDuration(long millis); static final long MS_PER_SEC; static final long MS_PER_MIN; static final long MS_PER_HOUR; static final long MS_PER_DAY; }### Answer:
@Test public void testFormatDuration() { Assert.assertEquals("0 secs", DateUtils.formatDuration(100)); Assert.assertEquals("0 secs", DateUtils.formatDuration(DateUtils.MS_PER_SEC - 1)); Assert.assertEquals("1 secs", DateUtils.formatDuration(DateUtils.MS_PER_SEC)); Assert.assertEquals("1 secs", DateUtils.formatDuration(DateUtils.MS_PER_SEC + 1)); Assert.assertEquals("59 secs", DateUtils.formatDuration(DateUtils.MS_PER_MIN - 1)); Assert.assertEquals("1 mins, 0 secs", DateUtils.formatDuration(DateUtils.MS_PER_MIN)); Assert.assertEquals("1 mins, 1 secs", DateUtils.formatDuration(DateUtils.MS_PER_MIN + DateUtils.MS_PER_SEC)); Assert.assertEquals("23 hours, 59 mins, 59 secs", DateUtils.formatDuration(DateUtils.MS_PER_DAY - 1)); Assert.assertEquals("1 days, 0 hours, 0 mins, 0 secs", DateUtils.formatDuration(DateUtils.MS_PER_DAY)); Assert.assertEquals("1 days, 0 hours, 0 mins, 0 secs", DateUtils.formatDuration(DateUtils.MS_PER_DAY + 1)); }