title: Override hashcode best practice
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/299304/why-does-javas-hashcode-in-string-use-31-as-a-multiplier">Why does Java&#39;s hashCode() in String use 31 as a multiplier?</a>  </p>
  </blockquote>
  
  
  
  <pre><code>@Override public int hashCode() {
      int result = 17 + hashDouble(re);
      result = 31 * result + hashDouble(im);
      return result;
  }
  </code></pre>
  
  <p>This is the code from "Effective Java".  Is it widely used in enterprise applications? I am concerned about adding the static values. Or should we define 17 and 31 as final variables in some sort of Utility class and reference them from there?  </p>
  
  <p>Also can someone explain what these numbers are for?  Is 31 just a prime number chosen randomly?  </p>