将总秒数转换为时分秒。
/** * 将总秒数转换为时分秒 * * @param strTime 秒数 * @return 时分秒 */ public String secToTime(String strTime) { int seconds = Integer.parseInt(strTime); int temp = 0; StringBuffer sb = new StringBuffer(); // / 除法,取商的整数; % 取模,取余数 temp = seconds / 3600; sb.append((temp < 10) ? "0" + temp + ":" : "" + temp + ":"); temp = seconds % 3600 / 60; sb.append((temp < 10) ? "0" + temp + ":" : "" + temp + ":"); temp = seconds % 3600 % 60; sb.append(( temp < 10) ? "0" + temp : "" + temp); return sb.toString(); }