Java Time Format formatTime(long ms)

Here you can find the source of formatTime(long ms)

Description

format Time

License

Open Source License

Declaration

public static String formatTime(long ms) 

Method Source Code

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

public class Main {
    public static String formatTime(long ms) {
        long secs = ms / 1000;
        long min = secs / 60;
        secs = secs % 60;//from  w w w  . j  av a 2s .  c  o  m
        ms = ms % 1000;

        if (min > 0) {
            return min + " minutes " + secs + " seconds " + ms + " ms";
        }

        return secs + " seconds " + ms + " ms";
    }
}

Related

  1. formatTime(long millis)
  2. formatTime(long millis)
  3. formatTime(long millis)
  4. formatTime(long millis, int precision)
  5. formatTime(long ms)
  6. formatTime(long msElapsed)
  7. formatTime(Long num)
  8. formatTime(long sec)
  9. formatTime(long seconds)