Here you can find the source of millisecondsToToTimeFormat(long inMs)
public static String millisecondsToToTimeFormat(long inMs)
//package com.java2s; /*//from ww w .j a v a2s .c o m * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-2.1.html * * This library 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. * * Contributors: * Thibaud arguillere */ public class Main { public static String millisecondsToToTimeFormat(long inMs) { long second = (inMs / 1000) % 60; long minute = (inMs / (1000 * 60)) % 60; long hour = (inMs / (1000 * 60 * 60)) % 24; return String.format("%d:%02d:%02d", hour, minute, second); } }