Android examples for java.lang:String Format
get Duration String from duration millisecond in long value
import java.util.concurrent.TimeUnit; public class Main { public static String getDurationString(long durationMs) { return String.format("%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(durationMs), TimeUnit.MILLISECONDS.toSeconds(durationMs) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(durationMs))); }/*from w w w . ja va 2 s . c om*/ }