Here you can find the source of getCalendarBefore(int i)
public static Calendar getCalendarBefore(int i)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { private static final String a = "yyyy-MM-dd HH:mm:ss:SSS"; public static Calendar getCalendarBefore(Date date, int i) { Calendar calendar;/* w w w . j a v a2 s .com*/ (calendar = Calendar.getInstance()).setTime(date); return getCalendarBefore(calendar, i); } public static Calendar getCalendarBefore(int i) { return getCalendarBefore(Calendar.getInstance(), i); } public static Calendar getCalendarBefore(Calendar calendar, int i) { calendar.add(5, -1 * i); return a(calendar); } private static Calendar a(Calendar calendar) { calendar.set(11, 0); calendar.clear(12); calendar.clear(13); calendar.clear(14); return calendar; } }