Here you can find the source of getLastDayOfTheYear(int year)
public static Date getLastDayOfTheYear(int year)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getLastDayOfTheYear(int year) { // get last day of the year Calendar lastDayOfThisYear = Calendar.getInstance(); lastDayOfThisYear.clear();//from w ww. java 2s . c om lastDayOfThisYear.set(Calendar.YEAR, year); lastDayOfThisYear.set(Calendar.DAY_OF_YEAR, 1); lastDayOfThisYear.add(Calendar.YEAR, 1); lastDayOfThisYear.add(Calendar.MILLISECOND, -1); return lastDayOfThisYear.getTime(); } }