i have a method which has to print the next seven days but instead of printing next seven days it prints last seven days,
could some one help me fixing this please
here is the method i use,
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class TestCalandar
{
public static void main(String[] args)
{
SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE");
String date[] = null;
date = df.format(new Date()).split("/");
Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(date[2]), Integer.parseInt(date[0]) - 1, Integer.parseInt(date[1]));
Map<String, String> currentWeekMap = new HashMap<String, String>();
for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++)
{
cal.set(Calendar.DAY_OF_WEEK, i);
currentWeekMap.put(dayFormat.format(cal.getTime()), df.format(cal.getTime()));
}
System.out.println(currentWeekMap);
}
}