Here you can find the source of addDays(Date date, int days)
public static Date addDays(Date date, int days)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date addDays(Date date, int days) { return add(date, Calendar.DATE, days); }//from w ww .j a v a2 s .c om private static Date add(Date date, int calendarField, int amount) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } Calendar c = Calendar.getInstance(); c.setTime(date); c.add(calendarField, amount); return c.getTime(); } }