See if you can spot the mistake in this code?
Heres the code…
public void fillSlots(String s, ScriptEntity.ScriptEntityType t, int startHour, int startMinute, int frequency)
{
frequency = frequency / MINUTES_IN_ONE_HOUR;
if (frequency == 0) {
return;
}
int iX = startMinute / MINUTES_IN_ONE_SLOT;
// X index: 0 minute -- iX (0); 15 minute -- iX (1);
// 30 minute -- iX (2); 45 minute -- iX (3).
int iY = startHour % Y_INDEX; // Y index
for (int i = iY; i < Y_INDEX; ) {
fillSlot(s, t, iX);
i =+ frequency;
}
}
Hint: Infinite loop !!!
About this entry
You’re currently reading “See if you can spot the mistake in this code?,” an entry on My Blog - My Thoughts
- Published:
- November 28, 2010 / 8:20 am
- Category:
- Horror Code, Java
- Tags:
- code, infinite loop, Java


7 Comments
Jump to comment form | comment rss [?] | trackback uri [?]