Here you can find the source of calculateLookbackDate(int lookback)
public static Date calculateLookbackDate(int lookback)
//package com.java2s; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; public class Main { static List<Date> holidayList = new ArrayList<Date>(); public static Date calculateLookbackDate(int lookback) { // today//from w w w.ja va 2 s .com Date dayCounter = new Date(); int validDatesCounter = lookback; while (validDatesCounter > 0) { // check for weekends and holiday list dayCounter.setDate(dayCounter.getDate() - 1); Calendar calendar = Calendar.getInstance(); calendar.setTime(dayCounter); if (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY && !holidayList.contains(dayCounter)) { validDatesCounter--; } } return dayCounter; } }