Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { private static Calendar add(long time, int val, int field) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); if (field == 666) { c.add(Calendar.MONTH, val * 3); } else { c.add(field, val); } return c; } }