import java.util.ArrayList;
import java.util.List;
public class Run {
public static int getNum(List<Cow> cowList,Integer year){
List<Cow> tempList = new ArrayList<Cow>();
for(int i=0,length=cowList.size();i<length;i++){
Cow cow = cowList.get(i);
if(cow.getAge()>=5){
Cow tempcow = new Cow(1);
tempList.add(tempcow);
}
cow.setAge((cow.getAge()+1));
}
year--;
cowList.addAll(tempList);
System.out.println(year);
if(year==0){
return cowList.size();
}
return getNum(cowList,year);
}
/**
* @param args
*/
public static void main(String[] args) {
List<Cow> cowList= new ArrayList<Cow>();
cowList.add(new Cow(1));
int year = 20;
int num =getNum(cowList,year);
System.out.println("aaa"+num);
}
}