Calendar eCal = Calendar.getInstance();
eCal.set(2011, 10, 1);
int iEday= eCal.getActualMaximum(Calendar.DAY_OF_MONTH);
System.out.println(eCal.toString()); // this line print out: java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Singapore",offset=28800000,dstSavings=0,useDaylight=false,transitions=9,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2011,MONTH=10,WEEK_OF_YEAR=45,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=309,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=8,HOUR_OF_DAY=20,MINUTE=50,SECOND=31,MILLISECOND=151,ZONE_OFFSET=28800000,DST_OFFSET=0]
System.out.println(eCal.MONTH); // this line print out: 2