3 ms·
True, but Java uses signed int's so the former should still work.
by stuff4ben 17y ago
True, but Java uses signed int's so the former should still work.
- mojuba 17y agoThat's the problem, if one int is negative and the other is positive, (high - low) may overflow.
- amalcon 17y agoIn this particular context, however, that should be just fine: low is clearly initialized to zero, and then only set to the value of this expression +1. As such, barring other bugs, low can never be negative. Your point is valid, though, and worth bearing in mind in other circumstances.