int p = d - 1;
if (p < 0) {
p += 7;
}
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE); // Time in minutes
<BUG>for (i = 0; i < startTimes.length; i++) {

int startTime = this.startTimes[i];

int endTime = this.endTimes[i];
</BUG>
if (startTime < endTime || endTime == -1) {

int p = d - 1;
if (p < 0) {
p += 7;
}
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE); // Time in minutes
for (i = 0; i < startTimes.size(); i++) {
int startTime = this.startTimes.get(i);
int endTime = this.endTimes.get(i);
if (startTime < endTime || endTime == -1) {
