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