I know one possible way of achieving this:
int a = 7;
int b = -10;
public int makeSmaller(int num) {
int result = Math.abs(num) - 1;
if(num > 0) return result;
else return -result;
}
makeSmaller(a); //returns 6
makeSmaller(b); //returns -9
Are there any more concise way of doing this could use to make this a little cleaner?
EDIT
I want the method to return a result closer to zero by exactly 1, so dividing by 2 or any other number won't work. Neither will multiplying by 0.