Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static int mpHash(String input) { int hash = 0; if (input == null || input.length() == 0) return hash; char[] chars = input.toLowerCase().toCharArray(); for (char c : chars) { hash = ((hash << 5) - hash) + c; } return hash; } }