Constructing integers is expensive.  Use Integer.signum(a - b) instead.