method one:
Date start = new Date();
...
...
...
Date end = new Date();
System.err.println("运行时间: "+(end-start)+"ms")
Method Two:
long startTime=System.currentTimeMillis();
...
...
...
long endTime=System.currentTimeMillis();
System.err.println("运行时间: "+(end-start)+"ms");
Method three:
long startTime=System.nanoTime();
...
...
...
long endTime=System.nanoTime();
System.err.println("运行时间: "+(end-start)+"ms");