if (myMonth <= 0) {
myMonth = 12;
}
Calendar calendar = new GregorianCalendar();
calendar.set(Calendar.MONTH, myMonth - 1); //-1, da Januar = 0
calendar.set(Calendar.YEAR, myYear);
calendar.getActualMaximum(Calendar.DAY_OF_MONTH)