Java Second Format formatSeconds(long time)

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

Description

format Seconds

License

Open Source License

Declaration

public static String formatSeconds(long time) 

Method Source Code

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

public class Main {
    public static String formatSeconds(long time) {
        if (time == Long.MAX_VALUE) {
            return "DNF";
        }//from  w ww .ja va  2s. c o  m

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

        time = (time + 5) / 10;

        long seconds = time / 100;
        long centiseconds = time % 100;

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

Related

  1. formatSeconds(long s, boolean letters)
  2. formatSeconds(long seconds)
  3. formatSeconds(long seconds)
  4. formatSeconds(long secsIn)
  5. formatSeconds(long time)
  6. formatSeconds(long time, String timerPrecisionId, boolean round)
  7. formatSecondsRegular(int seconds)
  8. formatSecondsWithHour(int seconds)
  9. formatTime(Date d, Locale locale, boolean withSeconds)