title: How to calculate the hash code of a string by hand?
body: <p>I was wondering how to calculate the hash code for a given string by hand. I understand that in Java, you can do something like:</p>
  
  <pre><code>String me = "What you say what you say what?";  
  long whatever = me.hashCode();
  </code></pre>
  
  <p>That's all good and dandy, but I was wondering how to do it by hand. I know the given formula for calculating the hash code of a string is something like:</p>
  
  <pre><code>S0 X 31 ^ (n-1) + S1 X 31 ^ (n-2) + .... + S(n-2) X 31 + S(n-1)  
  </code></pre>
  
  <p>Where S indicates the character in the string, and n is the length of the string. Using 16 bit unicode then, the first character from string me would be computed as:  </p>
  
  <pre><code>87 X (31 ^ 34)
  </code></pre>
  
  <p>However, that creates an insanely large number. I can't imagine adding all the characters together like that. So, in order to calculate the lowest-order 32 bits result then, what would I do? Long whatever from above equals -957986661 and I'm not how to calculate that?</p>