Here you can find the source of booleanToByte(boolean[] array)
public static byte booleanToByte(boolean[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static byte booleanToByte(boolean[] array) { byte val = 0; for (boolean b : array) { val <<= 1; if (b) val |= 1; }//from w ww . ja v a 2 s .c o m return val; } }