Joshua Bloch, in Item 8 of his book Effective
Java Programming Language Guide, suggests an algorithm for calculating a hashcode.
For a class with a single long field for a key, the resulting code would look like this:
where f is your long value, c1 is an arbitrary prime number and c2 is a non-zero number.
He's XOR'ing the upper 32 bits with the lower 32 bits.
If you haven't already,
you should read Joshua's book. It's full of good advice.
[ December 06, 2006: Message edited by: Scott Johnson ]