Here you can find the source of secondsToString(long seconds)
Parameter | Description |
---|---|
seconds | positive number, if negative it is multiplicated by -1 |
public static String secondsToString(long seconds)
//package com.java2s; //License from project: Apache License public class Main { /**/* w ww.j a va 2 s . c om*/ * Converts seconds from long to a String in the format "mm:ss". * * @param seconds * positive number, if negative it is multiplicated by -1 * @return String representation like "mm:ss" */ public static String secondsToString(long seconds) { if (seconds < 0) { seconds = seconds * -1; } return String.format("%02d:%02d", seconds / 60, seconds % 60); } }