Here you can find the source of getMonthLength(final int year, final int month)
public static int getMonthLength(final int year, final int month)
//package com.java2s; public class Main { private final static int[] DAYS_OF_MONTH = new int[] { 0, 31, // 1 28, // 2 31, // 3 30, // 4 31, // 5 30, // 6 31, // 7 31, // 8 30, // 9 31, // 10 30, // 11 31 // 12 };/* ww w . j av a2 s.c o m*/ public static int getMonthLength(final int year, final int month) { if (month == 2 && isLeapYear(year)) { return 29; } return DAYS_OF_MONTH[month]; } public static boolean isLeapYear(final int year) { return ((year % 4) == 0) // must be divisible by 4... && ((year < 1582) // and either before reform year... || ((year % 100) != 0) // or not a century... || ((year % 400) == 0)); // or a multiple of 400... } }