I need to check if two integers are on the same side of zero many times. I don\'t care if it\'s positive or negative, just that it\'s the same side... and performance is very im
(int1 ^ int2) >> 31 == 0 ? /*on same side*/ : /*different side*/ ;
This doesn't necessarily handle 0 correctly I'm not sure what you wanted to do in that case.
EDIT: also wanted to point out that if this was in c instead of java, it could be optimized further by getting rid of the == 0
because of the way that booleans work in c, the cases would be switched though