Here you can find the source of daysInMonth(int year, int month)
private static int daysInMonth(int year, int month)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.GregorianCalendar; public class Main { private static int daysInMonth(int year, int month) { Calendar mycal = new GregorianCalendar(year, month - 1, 1); return mycal.getActualMaximum(Calendar.DAY_OF_MONTH); }// ww w . ja v a2 s . c o m }