Here you can find the source of getLastMondayOfWeek(Date date)
public static Date getLastMondayOfWeek(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int FIRST_DAY_OF_WEEK = Calendar.MONDAY; public static Date getLastMondayOfWeek(Date date) { Date thismonday = getMondayOfWeek(date); Calendar monday = getCalendar(); monday.setTime(thismonday);/*from ww w. ja va 2 s . c o m*/ monday.add(Calendar.DAY_OF_YEAR, -7); return monday.getTime(); } public static Date getMondayOfWeek(Date date) { Calendar monday = getCalendar(); monday.setTime(date); monday.setFirstDayOfWeek(FIRST_DAY_OF_WEEK); monday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return monday.getTime(); } public static Date getMondayOfWeek(int year, int weekOfYear) { Calendar monday = getCalendar(); monday.set(Calendar.YEAR, year); monday.set(Calendar.WEEK_OF_YEAR, weekOfYear + 1); monday.setFirstDayOfWeek(FIRST_DAY_OF_WEEK); monday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return monday.getTime(); } private static Calendar getCalendar() { Calendar c = Calendar.getInstance(); c.setFirstDayOfWeek(FIRST_DAY_OF_WEEK); return c; } }