Here you can find the source of lastDay(Integer year, int month)
public static int lastDay(Integer year, int month)
//package com.java2s; import java.util.Calendar; public class Main { public static int lastDay(Integer year, int month) { Calendar cal = Calendar.getInstance(); cal.set(year, month - 1, 1);//from www. j a va 2 s .c o m cal.add(Calendar.MONTH, 1); cal.add(Calendar.DATE, -1); return cal.get(Calendar.DAY_OF_MONTH); } }