Attached program runs fine on Solaris sparc and x86 jdk 1.1.x and java2.
Wrong result on win32 jdk 1.1.x with jit. OK with java -nojit
$ java Gregorian
1. k = 0
2. k = 0
3. k = 0
4. k = 0
On 1.1.2000, it is Saturday.
E:\jdk1.1.8\bin>java Gregorian
1. k = 0
2. k = 0
3. k = 9028484
4. k = 9028484
On 1.1.2000, it is Tuesday.
Wrong result on win32 jdk 1.1.x with jit. OK with java -nojit
$ java Gregorian
1. k = 0
2. k = 0
3. k = 0
4. k = 0
On 1.1.2000, it is Saturday.
E:\jdk1.1.8\bin>java Gregorian
1. k = 0
2. k = 0
3. k = 9028484
4. k = 9028484
On 1.1.2000, it is Tuesday.