Here you can find the source of daysInMonth(int day, int month, int year)
public static int daysInMonth(int day, int month, int year)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static int daysInMonth(int day, int month, int year) { return new GregorianCalendar(year, month, day) .getActualMaximum(Calendar.DAY_OF_MONTH); }//w w w. j a va2 s .com public static int daysInMonth(Calendar c) { return daysInMonth(c.get(Calendar.DATE), c.get(Calendar.MONTH), c.get(Calendar.YEAR)); } }