I once got "bit by byte" in the following loop:
for(byte a=Byte.MIN_VALUE; a<=Byte.MAX_VALUE; a++) {
for(byte b=Byte.MIN_VALUE; b<=Byte.MAX_VALUE; b++) {
byte[] test = new byte[] { a, b};
//do something...
}
}
When I ran this, CPU shot to 100% and I had to take down Eclipse with
extreme prejudice. Can you spot the problem?
The problem is, neither of the loops can terminate. Neither for
condition will ever become false and cause the loop to terminate,
because neither a nor b can ever grow larger than Byte.MAX_VALUE. Duh.
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.