diff --git a/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java b/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java index 1fb7b66ec..7920434c3 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java +++ b/src/main/java/org/apache/commons/collections4/comparators/ComparatorChain.java @@ -278,10 +278,10 @@ public class ComparatorChain implements Comparator, Serializable { if (retval != 0) { // invert the order if it is a reverse sort if (orderingBits.get(comparatorIndex) == true) { - if (Integer.MIN_VALUE == retval) { - retval = Integer.MAX_VALUE; + if (retval > 0) { + retval = -1; } else { - retval *= -1; + retval = 1; } } return retval;