The hashcode must complete the following things (as per this page)

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html under hashCode()

- Must return the same integer result which results in the same comparison equals() provides.

In this example, equals is provided. If the integers match self, or their pair, it returns equals.

b) return a; -- This fails because if you had (4,5) (5,4) it should return equal values, this will not. (it would return 4 5 which are not equal)

d) return a-b; -- Again this fails with (4,5) (5,4). One returns 1, the other -1. These are not equal.

f) return (a<<16); This is similar to b. But do all integers left shifted 16 times return the same value? No. If this were a<<32 I think it would be a valid answer.

a) return 0;

c) retrun a+b;

e) return a^b;

All of these return the same equals values. All the expressions are commutative. You could also use (a*b), 27, b + a + b + a, 3*b + 3 * a

You could not use a/b or b/a or b or b*b or a*7.