Here you can find the source of addDays2Date(String str, int days)
public static Date addDays2Date(String str, int days) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date addDays2Date(String str, int days) throws ParseException { SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); Date date = fmt.parse(str); date.setTime(date.getTime() + (long) days * 1000L * 60L * 60L * 24L); return date; }/*from w w w.j a va 2s . c o m*/ public static Date addDays2Date(Date date, int days) throws ParseException { date.setTime(date.getTime() + (long) days * 1000L * 60L * 60L * 24L); return date; } }