Here you can find the source of hash(boolean[] array)
public static int hash(boolean[] array)
//package com.java2s; // it under the terms of the GNU General Public License as published by / public class Main { public static int hash(boolean[] array) { if (array.length == 4) { if (!array[0] && !array[1] && !array[2] && !array[3]) { return 0; }//from ww w. ja va 2 s . com return ((array[0] ? 1 : 0) << 3) + ((array[1] ? 1 : 0) << 2) + ((array[2] ? 1 : 0) << 1) + (array[3] ? 1 : 0); } int n = 0; for (int j = 0; j < array.length; ++j) { n = (n << 1) + (array[j] ? 1 : 0); } return n; } }