Here you can find the source of lastDayOfYear(Integer year)
public static Date lastDayOfYear(Integer year)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date lastDayOfYear(Integer year) { Date d = new Date(); d.setMonth(11);//from ww w.j a v a2 s . c o m d.setYear(year - 1900); d.setHours(23); d.setMinutes(59); Calendar calendar = Calendar.getInstance(); calendar.setTime(d); int lastDate = calendar.getActualMaximum(Calendar.DATE); calendar.set(Calendar.DATE, lastDate); return calendar.getTime(); } }