Removed use of Integer.compare and Long.compare, which are not available in Java 6.