Here you can find the source of hash(int x, int y)
public static int hash(int x, int y)
//package com.java2s; //License from project: Open Source License public class Main { public static int hash(int x, int y) { int h = 31; h = h * 97 + x;// www . ja va2 s . c om h *= 17; h = h * 97 + y; h *= 17; return h; } public static int hash(int x, int y, int z) { int h = 31; h = h * 97 + x; h *= 17; h = h * 97 + y; h *= 17; h = h * 97 + z; h *= 17; return h; } public static int hash(int x, int y, int z, int w) { int h = 31; h = h * 97 + x; h *= 17; h = h * 97 + y; h *= 17; h = h * 97 + z; h *= 17; h = h * 97 + w; h *= 17; return h; } public static int hash(int x, int y, int z, int w, int u) { int h = 31; h = h * 97 + x; h *= 17; h = h * 97 + y; h *= 17; h = h * 97 + z; h *= 17; h = h * 97 + w; h *= 17; h = h * 97 + u; h *= 17; return h; } }