Here you can find the source of booleanToBytes(boolean b)
public static byte[] booleanToBytes(boolean b)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] booleanToBytes(boolean b) { return new byte[] { (byte) (b ? 1 : 0) }; }/*from w ww . jav a2 s .c o m*/ }