Suppose I have an positive int x; I want to double x until it is larger than Integer.MAX_VALUE then stop.
I know MAX_VALUE = 2^31-1 and if x goes beyond this value, overflow occurs, and x becomes negative.
I'm wondering if I can use the condition (x < 0) to check if x goes beyond MAX_VALUE or not, because x is an integer, and it never goes beyond MAX_VALUE so I can't use (x > Integer.MAX_VALUE) to check.