Java tutorial
//package com.java2s; //* Licensed Materials - Property of IBM, Miracle A/S, and * import java.io.ByteArrayOutputStream; public class Main { public static void writeBoolean(ByteArrayOutputStream baos, Object o) { if (o instanceof Boolean) { writeBoolean(baos, Boolean.valueOf((Boolean) o)); } else { writeBoolean(baos, Boolean.valueOf(o.toString())); } } public static void writeBoolean(ByteArrayOutputStream baos, Boolean b) { if (b) { baos.write(1); } else { baos.write(0); } } }