Here you can find the source of daysInMonth(int month, boolean isLeapYear)
static int daysInMonth(int month, boolean isLeapYear)
//package com.java2s; // (c) 2012 B Smith-Mannschott -- Distributed under the Eclipse Public License public class Main { private static final byte[] DAYS_IN_MONTH = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, // non-leap-year 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, // leap year }; static int daysInMonth(int month, boolean isLeapYear) { int i = (month - 1) + 12 * (isLeapYear ? 1 : 0); return DAYS_IN_MONTH[i]; }/*from w w w .j a v a 2 s.c om*/ }