package Date1216;
import java.util.GregorianCalendar;
/**
* 计算并输出21世纪的闰年,计算程序的执行时间
* @author Administrator
*
*/
public class Runnian {
public static void main(String[] args) {
int count=0;
GregorianCalendar gc=new GregorianCalendar();
long l1=System.currentTimeMillis();
for(int i=2000;i<2100;i++){
if(gc.isLeapYear(i)){
count++;
}
}
long l2=System.currentTimeMillis();
System.out.println(count);
System.out.println(l2-l1);
}
}
来源:CSDN
作者:杨天福
链接:https://blog.csdn.net/ytfunnysite/article/details/53691994