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) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from w ww . jav a 2 s. c om*/ calendar.add(Calendar.DAY_OF_MONTH, days); return calendar.getTime(); } public static Date getTime(int hour, int minutes) { return getTime(hour, minutes, true); } public static Date getTime(int hour, int minutes, Boolean is24Hour) { Calendar calendar = Calendar.getInstance(); calendar.set(is24Hour ? Calendar.HOUR_OF_DAY : Calendar.HOUR, hour); calendar.set(Calendar.MINUTE, minutes); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); } }