public static int compareUnsignedInt(int x, int y) {

    // Can't assume JDK 1.8, so implementing this explicitly.
    // return Integer.compare(x + Integer.MIN_VALUE, y + Integer.MIN_VALUE);
    if (x == y) {
      return 0;
    }
    if (x + Integer.MIN_VALUE < y + Integer.MIN_VALUE) {
      return -1;
    } else {
      return 1;
    }
  }
If we can assume JDK 1.8, this should use
java.lang.Integer.compareUnsigned(), which will be replaced with intrinsics
in JVM.

@param x
         the first {@code int} to compare
@param y
         the second {@code int} to compare
@return the value {@code 0} if {@code x == y}; a value less than {@code 0}
        if {@code x < y} as unsigned values; and a value greater than
        {@code 0} if {@code x > y} as unsigned values
@see "http://hg.openjdk.java.net/jdk8/tl/jdk/rev/71200c517524"
common/src/java/org/apache/hadoop/hive/common/type/SqlMathUtil.java