Here you can find the source of millisecondsToString(long milliseconds)
Parameter | Description |
---|---|
milliseconds | time to be converted |
public static String millisecondsToString(long milliseconds)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww . j a v a 2s . co m*/ * Converts the given milliseconds to string. * * @param milliseconds time to be converted * @return string */ public static String millisecondsToString(long milliseconds) { int seconds = (int) (milliseconds / 1000) % 60; int minutes = (int) ((milliseconds / (1000 * 60)) % 60); int hours = (int) ((milliseconds / (1000 * 60 * 60)) % 24); return hours + " h " + minutes + " min " + seconds + " s"; } }