方法一:
Date start = new Date();
...
...
...
Date end = new Date();
System.err.println("运行时间: "+(end-start)+"ms")
方法二:
long startTime=System.currentTimeMillis();
...
...
...
long endTime=System.currentTimeMillis();
System.err.println("运行时间: "+(end-start)+"ms");
方法三:
long startTime=System.nanoTime();
...
...
...
long endTime=System.nanoTime();
System.err.println("运行时间: "+(end-start)+"ms");