Here you can find the source of lastDayOfMonth(Date date)
public static Date lastDayOfMonth(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date lastDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//w ww . j a va2 s. c o m cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance() .getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.HOUR_OF_DAY, Calendar.getInstance() .getActualMaximum(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, Calendar.getInstance().getActualMaximum(Calendar.MINUTE)); return cal.getTime(); } }