From 8c6de437fc27c522becd52179f91294e82a40134 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Fri, 4 Nov 2011 15:19:31 +0000 Subject: [PATCH] ICU-8854 Check for oddness that won't work for negative numbers. X-SVN-Rev: 30928 --- .../src/com/ibm/icu/text/CollationElementIterator.java | 4 ++-- icu4j/main/classes/core/src/com/ibm/icu/math/BigDecimal.java | 4 ++-- icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/icu4j/main/classes/collate/src/com/ibm/icu/text/CollationElementIterator.java b/icu4j/main/classes/collate/src/com/ibm/icu/text/CollationElementIterator.java index 230f4b4391..88173078a4 100644 --- a/icu4j/main/classes/collate/src/com/ibm/icu/text/CollationElementIterator.java +++ b/icu4j/main/classes/collate/src/com/ibm/icu/text/CollationElementIterator.java @@ -1895,7 +1895,7 @@ public final class CollationElementIterator // and add 5 (to avoid overlapping magic CE byte // values). The last byte we subtract 1 to ensure it is // less than all the other bytes. - if (digIndx % 2 == 1) { + if (digIndx % 2 != 0) { collateVal += digVal; // This removes trailing zeroes. if (collateVal == 0 && trailingZeroIndex == 0) { @@ -2487,7 +2487,7 @@ public final class CollationElementIterator // first digit encountered into the ones place and the // second digit encountered into the tens place. - if (digIndx % 2 == 1){ + if (digIndx % 2 != 0){ collateVal += digVal * 10; // This removes leading zeroes. diff --git a/icu4j/main/classes/core/src/com/ibm/icu/math/BigDecimal.java b/icu4j/main/classes/core/src/com/ibm/icu/math/BigDecimal.java index a108b56082..aa25183776 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/math/BigDecimal.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/math/BigDecimal.java @@ -9,7 +9,7 @@ import com.ibm.icu.lang.UCharacter; /* ------------------------------------------------------------------ */ /* BigDecimal -- Decimal arithmetic for Java */ /* ------------------------------------------------------------------ */ -/* Copyright IBM Corporation, 1996-2010. All Rights Reserved. */ +/* Copyright IBM Corporation, 1996-2011. All Rights Reserved. */ /* */ /* The BigDecimal class provides immutable arbitrary-precision */ /* floating point (including integer) decimal numbers. */ @@ -3697,7 +3697,7 @@ public class BigDecimal extends java.lang.Number implements java.io.Serializable if ((!(allzero(oldmant, len + 1)))) increment = sign; else /* 0.5000 */ - if ((((mant[mant.length - 1]) % 2)) == 1) + if ((((mant[mant.length - 1]) % 2)) != 0) increment = sign; } } else if (mode == ROUND_DOWN) { diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java b/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java index 486e05a71d..ffc826dbae 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java @@ -666,7 +666,7 @@ public class UnicodeSet extends UnicodeFilter implements Iterable, Compa // number of backslashes, then it has been escaped. // Before unescaping it, we delete the final // backslash. - if ((backslashCount % 2) == 1) { + if (backslashCount % 2 != 0) { result.setLength(result.length() - 1); } Utility.escapeUnprintable(result, c);