Timeline for How do I time a method's execution in Java?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 30, 2016 at 11:31 | review | Low quality answers | |||
| Nov 30, 2016 at 12:01 | |||||
| Jan 23, 2013 at 22:19 | comment | added | Rick Barkhouse | And to add remaining millis to the end, make the following changes: long millis = TimeUnit.MILLISECONDS.toMillis(duration) - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(duration)); if (days == 0) { res = String.format("%02d:%02d:%02d.%02d", hours, minutes, seconds, millis); } else { res = String.format("%dd%02d:%02d:%02d.%02d", days, hours, minutes, seconds, millis); } | |
| Jun 15, 2012 at 8:58 | comment | added | Leigh | Actually the question was how to calculate the amount of time a method takes, not how to format it. However this question is quite old (almost four years!). Try to avoid resurrecting old threads unless the response will add something new and significant over existing responses. | |
| Jun 15, 2012 at 8:50 | history | answered | iceberg | CC BY-SA 3.0 |