Java tutorial
//package com.java2s; public class Main { public static String formatTime(long t) { t /= 1000; return pad(t / 3600) + ":" + pad((t % 3600) / 60) + ":" + pad(t % 60); } private static String pad(long l) { if (l >= 10) return String.valueOf(l); else return "0" + String.valueOf(l); } }