Here you can find the source of getMonthDays(int year, int month)
public static int getMonthDays(int year, int month)
//package com.java2s; public class Main { public static int getMonthDays(int year, int month) { switch (month) { case 1:/*from w w w . j av a2 s .c o m*/ return 31; case 2: if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) { return 29; } else { return 28; } case 3: return 31; case 4: return 30; case 5: return 31; case 6: return 30; case 7: return 31; case 8: return 31; case 9: return 30; case 10: return 31; case 11: return 30; case 12: return 31; default: return 0; } } }