Here you can find the source of secondToString(long second)
public static String secondToString(long second)
//package com.java2s; //License from project: Apache License public class Main { public static String secondToString(long second) { long sec = second % 60; second = second / 60;// w w w . ja v a2 s . c o m long min = second % 60; long hour = second = second / 60; String nowTime = new String(); if (hour < 10) { if (hour == 0) nowTime = "00"; nowTime = "0" + hour; } else { nowTime = Long.toString(hour); } if (min < 10) { nowTime = nowTime + ":0" + min; } else { nowTime = nowTime + ":" + min; } if (sec < 10) { nowTime = nowTime + ":0" + sec; } else { nowTime = nowTime + ":" + sec; } return nowTime; } }