Here you can find the source of convertMsToMinutesAndSeconds(long ms)
Parameter | Description |
---|---|
ms | a parameter |
public static String convertMsToMinutesAndSeconds(long ms)
//package com.java2s; public class Main { /**// w ww. j a v a 2 s . co m * Convert milliseconds to mm:ss display format * * Note we don't break into hours, 3900000 ms would display as 65:00 , and we dont put a zero * before single digit minutes * * @param ms * @return */ public static String convertMsToMinutesAndSeconds(long ms) { int seconds = (int) ((ms / 1000) % 60); int minutes = (int) (ms / 60000); String secondsStr = (seconds < 10 ? "0" : "") + seconds; return new String(minutes + ":" + secondsStr); } }