...for nearly all cases reasonable good implementation was proposed in Josh Bloch's "Effective Java" in item 8.
The best thing is to look it up there because the author explains there why the approach is good.
A short version:
1) Create a int result and assign a non-zero value.
2) For every field tested in the equals-Method, calculate a hash code c by:
3) Combine the hash value c with result with:
result = 37 * result + c
4) Return result
This should result in a proper distribution of hash values for most use situations.