In Core
Java book volume one, there is this tip:
The compareTo method of the Comparable interface returns an integer. If the objects are not equal, it does not matter what negative or positive value you return. This flexibility can be useful when comparing integer fields. For example, suppose each employee has a unique integer id, and you want to sort by employee ID number. Then you can simply return id - other.id. That value will be some negative value if the first ID number is less than the other, 0 if they are the same ID, and some positive value otherwise. However, there is one caveat: The range of the integers must be small enough that the subtraction does not overflow. If you know that the IDs are not negative or that their absolute value is at most(Integer.MAX_VALUE - 1) / 2, you are safe.
i got everything in the tip except this part
that their absolute value is at most(Integer.MAX_VALUE - 1) / 2
What do they mean by that?
Thanks