Here you can find the source of millisToHMS(long millis)
public static String millisToHMS(long millis)
//package com.java2s; //License from project: Apache License public class Main { public static String millisToHMS(long millis) { boolean minus = false; if (millis < 0) { minus = true;//from w w w .j av a2 s . c o m millis = -millis; } long s = millis / 1000; long m = s / 60; long h = m / 60; String hms = String.format("%02d:%02d:%02d", h, m % 60, s % 60); return minus ? "-" + hms : hms; } }