Here you can find the source of getMonthLastDate(int month, int year)
private static int getMonthLastDate(int month, int year)
//package com.java2s; //License from project: Apache License public class Main { private static int getMonthLastDate(int month, int year) { int lastDay; switch (month) { case 0:/*w w w . j a v a2 s. c om*/ case 2: case 4: case 6: case 7: case 9: case 11: lastDay = 31; break; case 1: if (year % 4 == 0 && year % 100 == 0) lastDay = 29; else lastDay = 28; break; default: lastDay = 30; break; } return lastDay; } }