Here you can find the source of addDate(Date date, int calendarField, int amount)
private static Date addDate(Date date, int calendarField, int amount)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { private static Date addDate(Date date, int calendarField, int amount) { assertDateParamsRequired(date);/*from w w w . ja v a2 s. co m*/ Calendar c = Calendar.getInstance(); c.setTime(date); c.add(calendarField, amount); return c.getTime(); } private static void assertDateParamsRequired(Date... dates) { for (Date date : dates) { if (date == null) { throw new IllegalArgumentException("The Date type parameters are required."); } } } }