Here you can find the source of getReadableElapsedIntervalInSeconds(final long elapsedTimInMillis)
public static String getReadableElapsedIntervalInSeconds(final long elapsedTimInMillis)
//package com.java2s; import java.util.concurrent.TimeUnit; public class Main { public static String getReadableElapsedIntervalInSeconds(final long elapsedTimInMillis) { final long hours = TimeUnit.MILLISECONDS.toHours(elapsedTimInMillis); final long minutes = TimeUnit.MILLISECONDS.toMinutes(elapsedTimInMillis - TimeUnit.HOURS.toMillis(hours)); final long seconds = TimeUnit.MILLISECONDS .toSeconds(elapsedTimInMillis - TimeUnit.HOURS.toMillis(hours) - TimeUnit.MINUTES.toMillis(minutes)) + (hours * 60 * 60) + (minutes * 60); final long milliSeconds = TimeUnit.MILLISECONDS.toMillis(elapsedTimInMillis - TimeUnit.HOURS.toMillis(hours) - TimeUnit.MINUTES.toMillis(minutes) - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds( elapsedTimInMillis - TimeUnit.HOURS.toMillis(hours) - TimeUnit.MINUTES.toMillis(minutes)))); return String.format("%02d.%03d", seconds, milliSeconds); }/*from w w w . jav a2 s .c o m*/ }