Here you can find the source of getTimeFormat(final long time)
public static String getTimeFormat(final long time)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.TimeUnit; public class Main { public static String getTimeFormat(final long time) { final String format = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(time), TimeUnit.MILLISECONDS.toMinutes(time) % TimeUnit.HOURS.toMinutes(1), TimeUnit.MILLISECONDS.toSeconds(time) % TimeUnit.MINUTES.toSeconds(1)); return time < 3600000 ? format.substring(3) : format; }/*from ww w . j a v a 2 s . co m*/ }