Java Boolean to Byte booleanToBytes(boolean b)

Here you can find the source of booleanToBytes(boolean b)

Description

boolean To Bytes

License

Open Source License

Declaration

public static byte[] booleanToBytes(boolean b) 

Method Source Code

//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*/
}

Related

  1. booleanToByte(boolean[] bool)
  2. booleanToByte(boolean[] values)
  3. booleanTobyte(final boolean value)
  4. booleanToByteBitflags(boolean[] flags)
  5. booleanToBytes(boolean b)
  6. booleanToBytes(final boolean b)
  7. convertBooleanToByte(boolean inputBool)