Here you can find the source of booleanToByte(boolean[] values)
public static byte[] booleanToByte(boolean[] values)
//package com.java2s; public class Main { public static byte[] booleanToByte(boolean[] values) { if (values == null) { return null; }//w w w . j a va2 s . c o m byte[] results = new byte[values.length]; for (int i = 0; i < values.length; i++) { results[i] = (byte) (values[i] == true ? 1 : 0); } return results; } }