Consider the following code from IntWritable.java :
public int compare(byte b1, int s1, int l1,
byte b2, int s2, int l2)
If a Java Runtime subtracts 20 from -(2^31 - 10) it gets a huge positive number, not the negative value that the comparator should return.
LongWritable does this right, of course.
That last line should be
return (thisValue<thatValue ? -1 : (thisValue==thatValue ? 0 : 1));