Posted By

mscribellito on 03/02/11


Tagged


Versions (?)

hash


 / Published in: Java
 

  1. public static int hash(String s) {
  2. int h = 0;
  3. int len = s.length();
  4. for (int i = 0; i < len; i++)
  5. h = 31 * h + s.charAt(i);
  6. return h;
  7. }

Report this snippet  

You need to login to post a comment.