Java Minute Format formatMinutes(long time)

Here you can find the source of formatMinutes(long time)

Description

format Minutes

License

Open Source License

Declaration

public static String formatMinutes(long time) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String formatMinutes(long time) {
        if (time == Long.MAX_VALUE) {
            return "DNF";
        }//from   ww w . j a va 2  s.  co  m

        String sign = "";
        if (time < 0) {
            sign = "-";
            time = -time;
        }

        time = (time + 5) / 10;

        long minutes = time / 6000;
        long seconds = (time / 100) % 60;
        long centiseconds = time % 100;

        return sign + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds)
                + "." + (centiseconds < 10 ? "0" + centiseconds : centiseconds);
    }
}

Related

  1. calculateHourMinute(long ms)
  2. correctMinuteFormat(String minute)
  3. formatMinutes(double value)
  4. formatMinutes(int minutes)
  5. formatMinutes(long time)
  6. formatMinutes(long time, String timerPrecisionId, boolean round)
  7. formatMinutes(long timeMinutes)
  8. formatSecondsToMinutes(int secontsTotal)
  9. formatTimeInMinutes(long l)