GregorianCalendar setTime
Can someone explain why this occurs? Date d contains a date of 02/02/2002 -- why did the month increment?!
//test
cal =new java.util.GregorianCalendar(Integer.parseInt("2002"),Integer.parseInt("01"),Integer.parseInt("01"));
// Get the next day
cal.roll(java.util.GregorianCalendar.DATE, 1);
java.util.Date d = cal.getTime();
[568 byte] By [
jlemm] at [2007-9-27 1:22:12]

In Gregorian Calendar, the integers to specify months are zero-based, ie: January = 0.
Try this, it's a little simpler
...
import java.util.*;
int year=2002;
int month=0;
int day=1;
cal = new GregorianCalendar(year, month, day);
...
In Java's implementation of GregorianCalendar, months are based on 0. 0 is January, 1 is February, 2 is March, etc. Integer.parseInt("01") says you want to use February. The month is not being incremented, it's being set incorrectly in the first place.