Here you can find the source of hash(String s, int start, int end)
public static long hash(String s, int start, int end)
//package com.java2s; public class Main { public static long hash(String s, int start, int end) { if (start < 0) { start = 0;/*from ww w .ja va2s . co m*/ } if (end > s.length()) { end = s.length(); } long h = 0; for (int i = start; i < end; ++i) { h = (h << 5) - h + s.charAt(i); } return h; } }