Java · Loops

Off by one

The most common loop bug runs one pass too many or one too few, and two quick checks catch it.