if (endTime.getDay() == -1 && startTime.getHour() >= endTime.getHour()) {
if (!isSet(scheduleEndDay) && isTimeAfter(startTime, endTime)) {
    private TimeInterval theMostRecentIntervalBefore(Calendar t) {        TimeInterval timeInterval = getIntervalFromPool();        Calendar startCal = timeInterval.getStart();        startCal.setTimeInMillis(t.getTimeInMillis());        startCal.set(Calendar.MILLISECOND, 0);        if (startTime.getDay() != -1) {            startCal.set(Calendar.DAY_OF_WEEK, startTime.getDay());        }        if (startTime.getDay() == -1 && t.get(Calendar.HOUR_OF_DAY) < startTime.getHour()) {            startCal.add(Calendar.DATE, -1);        }        if (startTime.getDay() != -1                && (t.get(Calendar.DAY_OF_WEEK) < startTime.getDay() || (t                        .get(Calendar.DAY_OF_WEEK) == startTime.getDay() && t                        .get(Calendar.HOUR_OF_DAY) < startTime.getHour()))) {            startCal.add(Calendar.WEEK_OF_YEAR, -1);        }        startCal.set(Calendar.HOUR_OF_DAY, startTime.getHour());        startCal.set(Calendar.MINUTE, startTime.getMinute());        startCal.set(Calendar.SECOND, startTime.getSecond());        Calendar endCal = timeInterval.getEnd();        endCal.setTimeInMillis(startCal.getTimeInMillis());        if (endTime.getDay() != -1) {            endCal.set(Calendar.DAY_OF_WEEK, endTime.getDay());        }        if (endTime.getDay() == -1 && startTime.getHour() >= endTime.getHour()) {            endCal.add(Calendar.DATE, 1);        }        if (endTime.getDay() != -1                && (startTime.getDay() > endTime.getDay() || (startTime.getDay() == endTime                        .getDay() && startTime.getHour() >= endTime.getHour()))) {            endCal.add(Calendar.WEEK_OF_YEAR, 1);        }        endCal.set(Calendar.HOUR_OF_DAY, endTime.getHour());        endCal.set(Calendar.MINUTE, endTime.getMinute());        endCal.set(Calendar.SECOND, endTime.getSecond());        return timeInterval;    }