Here you can find the source of getDayOfMonth(int month, int year)
public static int getDayOfMonth(int month, int year)
//package com.java2s; public class Main { public static int getDayOfMonth(int month, int year) { int days = 0; if (month == 2) { if (year % 4 != 0) { days = 28;// www . java2 s . co m } else { if (year % 100 == 0 && year % 400 != 0) { days = 28; } else { days = 29; } } } else { switch (month) { case 1: days = 31; break; case 3: days = 31; break; case 4: days = 30; break; case 5: days = 31; break; case 6: days = 30; break; case 7: days = 31; break; case 8: days = 31; break; case 9: days = 30; break; case 10: days = 31; break; case 11: days = 30; break; case 12: days = 31; break; default: break; } } return days; } }