Perhaps this is what you meant?
long getUnsigned(int signed) {
return signed >= 0 ? signed : 2 * (long) Integer.MAX_VALUE + 2 + signed;
}
getUnsigned(0)
? 0getUnsigned(1)
? 1getUnsigned(Integer.MAX_VALUE)
? 2147483647getUnsigned(Integer.MIN_VALUE)
? 2147483648getUnsigned(Integer.MIN_VALUE + 1)
? 2147483649