Here you can find the source of getPrettyTime(long duration)
static String getPrettyTime(long duration)
//package com.java2s; import java.util.concurrent.TimeUnit; public class Main { static String getPrettyTime(long duration) { if (duration <= 0) throw new IllegalArgumentException(); return String.format("%02d:%02d:%02d.%03d", TimeUnit.MILLISECONDS.toHours(duration), TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)), TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)), duration - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(duration))); }/* w w w .java2 s.c om*/ }