Here you can find the source of toInt(boolean[] bits)
private static int toInt(boolean[] bits)
//package com.java2s; //License from project: Apache License public class Main { private static int toInt(boolean[] bits) { int value = 0; for (int i = 0; i < bits.length; i++) { boolean isSet = bits[i]; if (isSet) { value += 1 << bits.length - i - 1; }// w ww . jav a 2s. c o m } return value; } }