day -= 6;
day = Math.abs(day) - 6;
  private boolean isBefore(int calYear,			   int calMonth, int calDayOfMonth, int calDayOfWeek,			   int calMillis, int mode, int month,			   int day, int dayOfWeek, int millis)  {    // This method is called by Calendar, so we mustn't use that class.    // We have to do all calculations by hand.    // check the months:    // XXX - this is not correct:    // for the DOW_GE_DOM and DOW_LE_DOM modes the change date may    // be in a different month.    if (calMonth != month)      return calMonth < month;    // check the day:    switch (mode)      {      case DOM_MODE:	if (calDayOfMonth != day)	  return calDayOfMonth < day;	break;      case DOW_IN_MONTH_MODE:	{	  // This computes the day of month of the day of type	  // "dayOfWeek" that lies in the same (sunday based) week as cal.	  calDayOfMonth += (dayOfWeek - calDayOfWeek);	  // Now we convert it to 7 based number (to get a one based offset	  // after dividing by 7).  If we count from the end of the	  // month, we get want a -7 based number counting the days from 	  // the end:	  if (day < 0)	    calDayOfMonth -= getDaysInMonth(calMonth, calYear) + 7;	  else	    calDayOfMonth += 6;	  //  day > 0                    day < 0	  //  S  M  T  W  T  F  S        S  M  T  W  T  F  S	  //     7  8  9 10 11 12         -36-35-34-33-32-31	  // 13 14 15 16 17 18 19      -30-29-28-27-26-25-24	  // 20 21 22 23 24 25 26      -23-22-21-20-19-18-17	  // 27 28 29 30 31 32 33      -16-15-14-13-12-11-10	  // 34 35 36                   -9 -8 -7	  // Now we calculate the day of week in month:	  int week = calDayOfMonth / 7;	  //  day > 0                    day < 0	  //  S  M  T  W  T  F  S        S  M  T  W  T  F  S	  //     1  1  1  1  1  1          -5 -5 -4 -4 -4 -4	  //  1  2  2  2  2  2  2       -4 -4 -4 -3 -3 -3 -3	  //  2  3  3  3  3  3  3       -3 -3 -3 -2 -2 -2 -2	  //  3  4  4  4  4  4  4       -2 -2 -2 -1 -1 -1 -1	  //  4  5  5                   -1 -1 -1	  if (week != day)	    return week < day;	  if (calDayOfWeek != dayOfWeek)	    return calDayOfWeek < dayOfWeek;	  // daylight savings starts/ends  on the given day.	  break;	}      case DOW_LE_DOM_MODE:	// The greatest sunday before or equal December, 12	// is the same as smallest sunday after or equal December, 6.	day -= 6;      case DOW_GE_DOM_MODE:	// Calculate the day of month of the day of type	// "dayOfWeek" that lies before (or on) the given date.	calDayOfMonth -= (calDayOfWeek < dayOfWeek ? 7 : 0)	  + calDayOfWeek - dayOfWeek;	if (calDayOfMonth < day)	  return true;	if (calDayOfWeek != dayOfWeek || calDayOfMonth >= day + 7)	  return false;	// now we have the same day	break;      }    // the millis decides:    return (calMillis < millis);  }