Eclipse 3.5 has a very nice feature to generate Java hashCode() functions. It would generate for example (slightly shortened:)
class HashTest { int i;
You need to define your range for i and j. You could use a prime number for both.
public int hashCode() { http://primes.utm.edu/curios/ ;) return 97654321 * i ^ 12356789 * j; }