提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
计算运行时间
public class Main { public static void main(String[] args) throws Exception { // Get current time /** nowjava 提供 **/ long start = System.currentTimeMillis(); System.out.println(start); // Do something ... // Get elapsed time in milliseconds long elapsedTimeMillis = System.currentTimeMillis() - start; // Get elapsed time in seconds float elapsedTimeSec = elapsedTimeMillis / 1000F; /** 来自 时 代 J a v a 公 众 号 - nowjava.com**/ // Get elapsed time in minutes float elapsedTimeMin = elapsedTimeMillis / (60 * 1000F); // Get elapsed time in hours float elapsedTimeHour =