Here you can find the source of formatMillis(long millis)
public static String formatMillis(long millis)
//package com.java2s; //License from project: LGPL import java.util.concurrent.TimeUnit; public class Main { public static String formatMillis(long millis) { return String.format("%dd:%dh:%dm:%ds:%dms", TimeUnit.MILLISECONDS.toDays(millis), TimeUnit.MILLISECONDS.toHours(millis) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(millis)), TimeUnit.MILLISECONDS.toMinutes(millis) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millis)), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis)), millis - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(millis))); }// w w w .ja v a 2 s .c o m }