Since java quietly allows overflow and carry. Is there another way to check the answer of a mathmatical operation for overflow besides checking for the max and min values of ints?
How about carry, the only way I can see is to hold the first bit of both ints in temp variables then doing the mathmatical operation and placing the answers first bit in a temp variable and doing several if statements to check if a carry occurred. However, this seems redundant! I realize an overflow will not occur if the first bit of both numbers are of opposite sign, so I guess I could check that first but it seems like that would waste execution time! Thanks, for any advice.