diff --git a/user/super/com/google/gwt/emul/java/math/BigDecimal.java b/user/super/com/google/gwt/emul/java/math/BigDecimal.java
index ffbdfb7..107151d 100644
--- a/user/super/com/google/gwt/emul/java/math/BigDecimal.java
+++ b/user/super/com/google/gwt/emul/java/math/BigDecimal.java
@@ -350,7 +350,7 @@
     if (scaledDivisor.bitLength() < SMALL_VALUE_BITS) {
       long rem = remainder.longValue();
       long divisor = scaledDivisor.longValue();
-      compRem = longCompareTo(Math.abs(rem) << 1, Math.abs(divisor));
+      compRem = Long.compare(Math.abs(rem) << 1, Math.abs(divisor));
       // To look if there is a carry
       compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign
           * (5 + compRem), roundingMode);
@@ -395,10 +395,6 @@
     return quotient > 0 ? Math.floor(quotient) : Math.ceil(quotient);
   }
 
-  private static int longCompareTo(long a, long b) {
-    return Long.signum(a - b);
-  }
-
   private static native double parseUnscaled(String str) /*-{
     var unscaledRegex = @java.math.BigDecimal::unscaledRegex;
     if (!unscaledRegex) {
@@ -2790,7 +2786,7 @@
     // If the discarded fraction is non-zero perform rounding
     if (fraction != 0) {
       // To check if the discarded fraction >= 0.5
-      compRem = longCompareTo(Math.abs(fraction) << 1, sizeOfFraction);
+      compRem = Long.compare(Math.abs(fraction) << 1, sizeOfFraction);
       // To look if there is a carry
       integer += roundingBehavior(((int) integer) & 1, Long.signum(fraction)
           * (5 + compRem), mc.getRoundingMode());
diff --git a/user/super/com/google/gwt/emul/java/sql/Timestamp.java b/user/super/com/google/gwt/emul/java/sql/Timestamp.java
index 8f77f7c..e02af6a 100644
--- a/user/super/com/google/gwt/emul/java/sql/Timestamp.java
+++ b/user/super/com/google/gwt/emul/java/sql/Timestamp.java
@@ -116,15 +116,15 @@
   }
 
   public int compareTo(Timestamp o) {
-    int sign = Long.signum(getTime() - o.getTime());
-    return sign == 0 ? getNanos() - o.getNanos() : sign;
+    int cmp = Long.compare(getTime(), o.getTime());
+    return cmp == 0 ? Integer.compare(getNanos(), o.getNanos()) : cmp;
   }
 
   @Override
   public boolean equals(Object ts) {
     // Timestamps can't be compared to java.util.Date
     // This is known to not be symmetric, which follows the JRE.
-    return ts instanceof Timestamp ? equals((Timestamp) ts) : false;
+    return (ts instanceof Timestamp) && equals((Timestamp) ts);
   }
 
   public boolean equals(Timestamp ts) {
diff --git a/user/super/com/google/gwt/emul/java/util/Date.java b/user/super/com/google/gwt/emul/java/util/Date.java
index 06a4416..d81aa7e 100644
--- a/user/super/com/google/gwt/emul/java/util/Date.java
+++ b/user/super/com/google/gwt/emul/java/util/Date.java
@@ -125,7 +125,7 @@
   }
 
   public int compareTo(Date other) {
-    return Long.signum(getTime() - other.getTime());
+    return Long.compare(getTime(), other.getTime());
   }
 
   @Override
