public static String getDurationBreakdown(long millis) {

    long hours = TimeUnit.MILLISECONDS.toHours(millis);
    millis -= TimeUnit.HOURS.toMillis(hours);
    long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
    millis -= TimeUnit.MINUTES.toMillis(minutes);
    long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);

    return String.format("%d:%02d:%02d", hours, minutes, seconds);
  }
Convert a millisecond duration to a string format

@param millis A duration to convert to a string form
@return A string of the form "X:Y:Z Hours".
app/com/linkedin/drelephant/util/Utils.java