Java tutorial
//package com.java2s; public class Main { public static String timeFormatToString(int relTime) { StringBuffer timeBuf = new StringBuffer(); relTime /= 1000; int time = relTime / 3600; if (time >= 10) { timeBuf.append(time); } else { timeBuf.append("0").append(time); } relTime %= 3600; time = relTime / 60; if (time >= 10) { timeBuf.append(":").append(time); } else { timeBuf.append(":0").append(time); } time = relTime % 60; if (time >= 10) { timeBuf.append(":").append(time); } else { timeBuf.append(":0").append(time); } return timeBuf.toString(); } }