Eclipse 3.5 has a very nice feature to generate Java hashCode() functions. It would generate for example (slightly shortened:)
class HashTest { int i;
I just want to point out that hashcode has nothing to do with prime. In JDK implementation
for (int i = 0; i < value.length; i++) { h = 31 * h + val[i]; }
I found if you replace 31 with 27, the result are very similar.