测试代码:
public class Demo {
private static void testHash(int tableLength) {
final int mask = tableLength - 1;
final int add = 0x61c88647 * 2;
int hash = 0;
for (int i = 0; i < tableLength; i++) {
hash += add;
int index = hash & mask;
System.out.print(" "+index);
}
}
public static void main(String[] args) {
testHash(32);
}
输出结果:
14 28 10 24 6 20 2 16 30 12 26 8 22 4 18 0 14 28 10 24 6 20 2 16 30 12 26 8 22 4 18 0