Here you can find the source of second2time(int seconds)
public static String second2time(int seconds)
//package com.java2s; //License from project: Apache License public class Main { public static String second2time(int seconds) { int hour = seconds / 3600; int other = seconds % 3600; int minute = other / 60; int second = other % 60; StringBuilder sb = new StringBuilder(); if (hour < 10) { sb.append("0"); }/*www . j a v a 2 s. c o m*/ sb.append(hour); sb.append(":"); if (minute < 10) { sb.append("0"); } sb.append(minute); sb.append(":"); if (second < 10) { sb.append("0"); } sb.append(second); return sb.toString(); } }