Here you can find the source of getFormattedTimeForMS(Long timeInMillis)
public static String getFormattedTimeForMS(Long timeInMillis)
//package com.java2s; import java.util.concurrent.TimeUnit; public class Main { public static String getFormattedTimeForMS(Long timeInMillis) { TimeUnit timeunit = TimeUnit.MILLISECONDS; long hours = timeunit.toHours(timeInMillis); long minutes = timeunit.toMinutes(timeInMillis) - TimeUnit.HOURS.toMinutes(hours); long seconds = timeunit.toSeconds(timeInMillis) - TimeUnit.HOURS.toSeconds(hours) - TimeUnit.MINUTES.toSeconds(minutes); return ((hours < 10) ? "0" + hours : hours) + ":" + ((minutes < 10) ? "0" + minutes : minutes) + ":" + ((seconds < 10) ? "0" + seconds : seconds); }//from w ww.j a va2 s. c o m }