Java Boolean to Byte booleanToByte(boolean x)

Here you can find the source of booleanToByte(boolean x)

Description

boolean To Byte

License

Apache License

Declaration

public static byte[] booleanToByte(boolean x) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] booleanToByte(boolean x) {
        if (x) {//from   w  w  w.j a v  a  2 s.  c o  m
            return new byte[] { (byte) 1 };
        } else {
            return new byte[] { (byte) 0 };
        }
    }
}

Related

  1. booleanToByte(boolean b)
  2. BooleanToByte(boolean value)
  3. booleanToByte(boolean[] array)
  4. booleanToByte(boolean[] bool)
  5. booleanToByte(boolean[] values)
  6. booleanTobyte(final boolean value)