What Java method takes an int and returns +1 or -1? The criteria for this is whether or not the int is positive or negative. I looked through the docum
int
Strictly evaluating to -1 or 1, and cooler (probably more efficient too) than n < 0 ? -1: 1:
n < 0 ? -1: 1
(n >> 31) | 1
In case you want to use it for long too:
long
(n >> 63) | 1