Here you can find the source of hash(char[] str, int start, int length)
public static final int hash(char[] str, int start, int length)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w. j a va 2 s . c o m*/ * IBM Corporation - initial API and implementation *******************************************************************************/ public class Main { public static final int hash(char[] str, int start, int length) { int h = 0; int end = start + length; for (int curr = start; curr < end; ++curr) h += (h << 3) + str[curr]; return h; } public static final int hash(char[] str) { return hash(str, 0, str.length); } }