Correct Way of Calculating Elapsed Time in Java

You may also like...

  • Nathaniel M

    public String toMinuteSeconds(){
    return String.format(“%d min, %d sec”, time(TimeUnit.MINUTES),
    time(TimeUnit.SECONDS) – (time(TimeUnit.MINUTES) * 60));
    }

    The original didn’t have the ” * 60″, so the seconds didn’t subtract correctly.