Most idiomatic way to print a time difference in Java?

前端 未结 6 1125
后悔当初
后悔当初 2020-11-27 22:54

I\'m familiar with printing time difference in milliseconds:

 long time = System.currentTimeMillis();
 //do something that takes some time...
 long completed         


        
6条回答
  •  半阙折子戏
    2020-11-27 23:28

    If you actually want to see a millisecond difference, I don't think there's a shorter, simpler way.

    If you need a more powerful (but certainly not simpler) way to collect performance statistics, there is Perf4J.

提交回复
热议问题