Here you can find the source of getFirstDayOfWeek(Date date)
public static Date getFirstDayOfWeek(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getFirstDayOfWeek(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//w ww. j ava 2 s .c o m return getADayOfWeek(calendar, Calendar.MONDAY).getTime(); } private static Calendar getADayOfWeek(Calendar day, int dayOfWeek) { int week = day.get(Calendar.DAY_OF_WEEK); if (week == dayOfWeek) return day; int diffDay = dayOfWeek - week; if (week == Calendar.SUNDAY) { diffDay -= 7; } else if (dayOfWeek == Calendar.SUNDAY) { diffDay += 7; } day.add(Calendar.DATE, diffDay); return day; } }