Here you can find the source of calculateByDate(Date d, int amount)
public static Date calculateByDate(Date d, int amount)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date calculateByDate(Date d, int amount) { return calculate(d, Calendar.DATE, amount); }/*from w w w . ja va 2 s . c o m*/ private static Date calculate(Date d, int field, int amount) { if (d == null) return null; GregorianCalendar g = new GregorianCalendar(); g.setGregorianChange(d); g.add(field, amount); return g.getTime(); } }