Here you can find the source of lastDay(Date date)
public static Date lastDay(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date lastDay(Date date) { Calendar calendar = convert(date); calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE)); return calendar.getTime(); }/*from www. j a va2 s .c o m*/ private static Calendar convert(Date date) { Calendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar; } }