Here you can find the source of lastDayOfWeek(Calendar calendar)
public static final Calendar lastDayOfWeek(Calendar calendar)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static final Calendar lastDayOfWeek(Calendar calendar) { Calendar cal = (Calendar) calendar.clone(); int day = cal.get(Calendar.DAY_OF_YEAR); while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { cal.set(Calendar.DAY_OF_YEAR, ++day); }// w ww . j av a 2s .co m return cal; } }