package com.bowen.dong; import java.util.Properties; import java.util.Set; /** * @author bw * */ public class Test { public static void main(String[] args) { // 计算程序在进行求和操作时所耗费的时间 //循环开始时的当前时间 long starttime =System.currentTimeMillis(); int sum = 0; for(int i=0;i<100000000;i++) { sum+=i; } //循环结束的时间 long endtime = System.currentTimeMillis(); System.out.println("程序运行的时间为:"+(endtime-starttime)+"毫秒");