Here you can find the source of secondsToHHMMSS(int secs)
public static String secondsToHHMMSS(int secs)
//package com.java2s; /**/*from w ww . ja v a 2 s . c o m*/ * Copyright (c) 2011-2014, OpenIoT * * This file is part of OpenIoT. * * OpenIoT is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, version 3 of the License. * * OpenIoT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with OpenIoT. If not, see <http://www.gnu.org/licenses/>. * * Contact: OpenIoT mailto: info@openiot.eu */ public class Main { public static String secondsToHHMMSS(int secs) { String result = ""; int hours = secs / 3600, remainder = secs % 3600, minutes = remainder / 60, seconds = remainder % 60; String disHour = (hours < 10 ? "0" : "") + hours, disMinu = (minutes < 10 ? "0" : "") + minutes, disSec = (seconds < 10 ? "0" : "") + seconds; result = disHour + ":" + disMinu + ":" + disSec; return result; } }