Here you can find the source of getIndexDay(Date origin, int index)
public static Date getIndexDay(Date origin, int index)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getIndexDay(Date origin, int index) { Date dt = origin;/*from ww w . j av a2s. c o m*/ Calendar rightNow = Calendar.getInstance(); rightNow.setTime(dt); rightNow.add(Calendar.DAY_OF_YEAR, index); Date dt1 = rightNow.getTime(); // String reStr = sdf.format(dt1); //System.out.println(reStr); return dt1; } }