Here you can find the source of convertTime(long time)
public static String convertTime(long time)
//package com.java2s; //License from project: Open Source License public class Main { public static String convertTime(long time) { int ms1 = (int) time; int secs = ms1 / 1000; int mins = secs / 60; int hours = mins / 60; hours %= 24;//w ww . j a v a2 s.c o m secs %= 60; mins %= 60; ms1 %= 1000; String hoursS = "" + hours; String secsS = "" + secs; String minsS = "" + mins; String ms2 = "" + ms1; if (secs < 10) secsS = "0" + secsS; if (mins < 10) minsS = "0" + minsS; if (hours < 10) hoursS = "0" + hoursS; return hoursS + "h:" + minsS + "m:" + secsS + "s:" + ms2 + "ms"; } }