Java Utililty Methods Boolean From

List of utility methods to do Boolean From

Description

The list of methods to do Boolean From are organized into topic(s).

Method

BooleantoBoolean(boolean b)
to Boolean
return b ? Boolean.TRUE : Boolean.FALSE;
booleantoBoolean(Boolean bool)

Converts a Boolean to a boolean handling null by returning false .

 BooleanUtils.toBoolean(Boolean.TRUE)  = true BooleanUtils.toBoolean(Boolean.FALSE) = false BooleanUtils.toBoolean(null)          = false 
return bool != null && bool.booleanValue();
booleantoBoolean(Boolean bool)
to Boolean
if (bool == null) {
    return false;
return bool;
BooleantoBoolean(boolean bool)
Converts a boolean value into Boolean.
if (bool) {
    return Boolean.TRUE;
} else {
    return Boolean.FALSE;
booleantoBoolean(Boolean bool, boolean defaultValue)
to Boolean
if (bool == null)
    return defaultValue;
return bool;
StringtoBoolean(byte b)
See RFC2910, http://www.ietf.org/rfc/rfc2910 IPP boolean is defined as SIGNED-BYTE where 0x00 is 'false' and 0x01 is 'true'
return (b == 0) ? "false" : "true";
voidtoBoolean(byte data[], int offset, boolean value)
to Boolean
data[offset] = (value ? BOOLEAN_TRUE : BOOLEAN_FALSE);
ObjecttoBoolean(byte t_logical)
Convert LOGICAL (L) byte to boolean value
if (t_logical == 'Y' || t_logical == 'y' || t_logical == 'T' || t_logical == 't') {
    return Boolean.TRUE;
} else if (t_logical == 'N' || t_logical == 'n' || t_logical == 'F' || t_logical == 'f') {
    return Boolean.FALSE;
return null;
booleantoBoolean(byte[] b)
to Boolean
return toBoolean(b, 0);
booleantoBoolean(byte[] byteArray)
to Boolean
return (byteArray == null || byteArray.length == 0) ? false : byteArray[0] != 0x00;