Adjust calendar to the end of the current month.

@param c the calendar
508677
protected final void endOfMonth(final Calendar c) {
        c.set(Calendar.DAY_OF_MONTH,
                c.getActualMaximum(Calendar.DAY_OF_MONTH));
    }
348269
public Calendar adjustDate(final Calendar startDate, final int increment, final NonWorkingDayChecker<Calendar> checker) {
         final Calendar cal = (Calendar) startDate.clone();
         int step = increment;
         final int month = cal.get(Calendar.MONTH);

         while (checker.isNonWorkingDay(cal)) {
             cal.add(Calendar.DAY_OF_MONTH, step);
             if (month != cal.get(Calendar.MONTH)) {
                 // switch direction and go back
                 step *= -1;
                 cal.add(Calendar.DAY_OF_MONTH, step);
             }
         }

         return cal;
     }
129173
private void decodeEndRule() {
        useDaylight = (startDay != 0) && (endDay != 0);
        if (endDay != 0) {
            if (endMonth < Calendar.JANUARY || endMonth > Calendar.DECEMBER) {
                throw new IllegalArgumentException(
                        "Illegal end month " + endMonth);
            }
            if (endTime < 0 || endTime > millisPerDay) {
                throw new IllegalArgumentException(
                        "Illegal end time " + endTime);
            }
            if (endDayOfWeek == 0) {
                endMode = DOM_MODE;
            } else {
                if (endDayOfWeek > 0) {
                    endMode = DOW_IN_MONTH_MODE;
                } else {
                    endDayOfWeek = -endDayOfWeek;
                    if (endDay > 0) {
                        endMode = DOW_GE_DOM_MODE;
                    } else {
                        endDay = -endDay;
                        endMode = DOW_LE_DOM_MODE;
                    }
                }
                if (endDayOfWeek > Calendar.SATURDAY) {
                    throw new IllegalArgumentException(
                           "Illegal end day of week " + endDayOfWeek);
                }
            }
            if (endMode == DOW_IN_MONTH_MODE) {
                if (endDay < -5 || endDay > 5) {
                    throw new IllegalArgumentException(
                            "Illegal end day of week in month " + endDay);
                }
            } else if (endDay < 1 || endDay > staticMonthLength[endMonth]) {
                throw new IllegalArgumentException(
                        "Illegal end day " + endDay);
            }
        }
    }
1174323
private void resetCalendar() {
    _calendar = getCalendar();
    if (_defaultTimeZone != null) {
      _calendar.setTimeZone(_defaultTimeZone);
    }
    _currentYear = _calendar.get(Calendar.YEAR);
  }
1183281
void formatWeekOfMonth(StringBuilder b, ZonedDateTime d, int width) {
    int w = d.get(ChronoField.ALIGNED_WEEK_OF_MONTH);
    if (width == 1) {
      b.append(w);
    }
  }
355563
public Date adjustDate(final Date startDate, final int increment, final NonWorkingDayChecker<Date> checker) {
        final Calendar cal = (Calendar) Utils.getCal(startDate).clone();
        int step = increment;
        final int month = cal.get(Calendar.MONTH);

        while (checker.isNonWorkingDay(cal.getTime())) {
            cal.add(Calendar.DAY_OF_MONTH, step);
            if (month != cal.get(Calendar.MONTH)) {
                // switch direction and go back
                step *= -1;
                cal.add(Calendar.DAY_OF_MONTH, step);
            }
        }

        return cal.getTime();
    }
265555
private JSONWriter end(char m, char c) throws JSONException {
        if (this.mode != m) {
            throw new JSONException(m == 'a'
                ? "Misplaced endArray."
                : "Misplaced endObject.");
        }
        this.pop(m);
        try {
            this.writer.append(c);
        } catch (IOException e) {
        	// Android as of API 25 does not support this exception constructor
        	// however we won't worry about it. If an exception is happening here
        	// it will just throw a "Method not found" exception instead.
            throw new JSONException(e);
        }
        this.comma = true;
        return this;
    }
690126
private static void moveToIMMDay(final Calendar cal) {
        cal.set(DAY_OF_MONTH, 1);

        // go to 1st wed
        final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
        if (dayOfWeek < WEDNESDAY) {
            cal.add(DAY_OF_MONTH, WEDNESDAY - dayOfWeek);
        } else if (dayOfWeek > WEDNESDAY) {
            cal.add(DAY_OF_MONTH, WEDNESDAY + NUMBER_DAYS_IN_WEEK - dayOfWeek);
        }

        // go to 3rd wednesday - i.e. move 2 weeks forward
        cal.add(DAY_OF_MONTH, NUMBER_DAYS_IN_WEEK * 2);
    }
1222046
public static String removeEnd(final String s, final char c) {
		if (endWith(s, c)) {
			return s.substring(0, s.length() - 1);
		}
		return s;
	}
538707
private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
		if (isLeapYear && month == 2) {
			return value == 29;
		} else {
			return value == LAST_DAYS[month - 1];
		}
	}
1049927
public int getMonth()
    {
        Timestamp adjusted = this;

        if (this._offset != null) {
            if (this._offset.intValue() != 0) {
                adjusted = make_localtime();
            }
        }
        return adjusted._month;
    }
956808
protected void setCalendarHour(Calendar cal, int hour) {
    cal.set(Calendar.HOUR_OF_DAY, hour);
    if (cal.get(Calendar.HOUR_OF_DAY) != hour && hour != 24) {
      cal.set(Calendar.HOUR_OF_DAY, hour + 1);
    }
  }
470681
function(month)
        {
            if (!isNaN( (month = parseInt(month, 10)) )) {
                this._m = month < 0 ? 0 : month > 11 ? 11 : month;
                this.draw();
            }
        }
34580
private static boolean checkDate(Calendar cal, Calendar other) {
		return checkDate(cal, other.get(Calendar.DATE), other.get(Calendar.MONTH));
	}
15960
@Override
    public void setPeriod(int pPeriod) {
	if (pPeriod < 0) {
	    throw new IllegalArgumentException("Period cannot be negative");
	}
	int actual = Math.max(pPeriod, MIN_PERIOD);
	log.debug("Changing clock period to {}", actual);
	period = actual;

	if (isRunning()) {
	    stop();
	    start(false);
	}
    }
828527
@Override
  public void setEndTime(Date endTime) {

    Date sTime = getStartTime();
    if (sTime != null && endTime != null && sTime.after(endTime)) {
      throw new IllegalArgumentException("End time cannot be before start time");
    }

    this.endTime = endTime;
  }
941198
public final void setToOne(int c) {
        if( 0x10ffff<c) {
            return;
        }

        if(c<0xffff) {
            bmpLength=length=2;
            array[0]=(char)c;
            array[1]=(char)(c+1);
        } else if(c==0xffff) {
            bmpLength=1;
            length=3;
            array[0]=0xffff;
            array[1]=1;
            array[2]=0;
        } else if(c<0x10ffff) {
            bmpLength=0;
            length=4;
            array[0]=(char)(c>>16);
            array[1]=(char)c;
            ++c;
            array[2]=(char)(c>>16);
            array[3]=(char)c;
        } else /* c==0x10ffff */ {
            bmpLength=0;
            length=2;
            array[0]=0x10;
            array[1]=0xffff;
        }
    }