Here you can find the source of daysInMonth(int year, int month)
public static int daysInMonth(int year, int month)
//package com.java2s; //License from project: Apache License public class Main { public static int daysInMonth(int year, int month) { //Month in java.util.Calendar is 0-based, so subtract 1: java.util.Calendar cal = new java.util.GregorianCalendar(year, month - 1, 1); return cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH); }/*from w ww. j a va 2s. com*/ }