程序执行时间

private static void demo2(){
long start = System.currentTimeMillis();
int temp = 0;
for (int i=0;i<100000000;i++){
temp++;
}
long end = System.currentTimeMillis();
long time = end - start;
System.out.println("temp="+temp);
System.out.println("程序执行时间"+(time/1000)+"");
}
posted @ 2022-05-25 17:33  alcasd  阅读(43)  评论(0)    收藏  举报