Here you can find the source of getMonthLength(int year, int month)
private static int getMonthLength(int year, int month)
//package com.java2s; public class Main { private static final int[] teMl = new int[] { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; private static int getMonthLength(int year, int month) { int ml;//from w w w .ja va 2 s . co m if ((month == 2) && (isLeapYear(year))) { ml = 29; } else { ml = teMl[month]; } return (ml); } private static boolean isLeapYear(int year) { // This is the Gregorian Calendar return ((year % 400) == 0) || (((year % 4) == 0) && ((year % 100) != 0)); } }