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

booleantoBool(Boolean obj)
to Bool
if (obj == null) {
    return false;
} else {
    return obj;
booleantoBool(int[] data, int index)
Extract a boolean value from an array of int data
int length = data.length;
if (index < 0 || index >= length) {
    throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);
return data[index] == 0 ? false : true;
booleantoBool(long l)
Returns the boolean for the given long.
If long is 1L this will return TRUE, else FALSE.
if (l == 1L) {
    return true;
return false;
booleantoBool(String bStr)
to Bool
if (bStr != null) {
    return Boolean.parseBoolean(bStr);
return false;
StringtoBool(String bv)
to Bool
return "(tobool " + bv + ")";
booleantoBool(String str)
Returns a boolean representation of the provided string
switch (str.charAt(0)) {
case 't':
case 'T':
case '1':
    return true;
default:
    return false;
booleantoBool(String str)
to Bool
if (!str.toLowerCase().equals("false") && !str.toLowerCase().equals("true"))
    throw new NumberFormatException("Can't convert '" + str + "' to bool");
return Boolean.parseBoolean(str);
booleantoBool(String v, boolean def)
Converts specified string to boolean.
if (v == null)
    return def;
return v.equalsIgnoreCase("TRUE") || v.equalsIgnoreCase("YES") || v.equalsIgnoreCase("1")
        || v.equalsIgnoreCase("ON");
booleantoBool(String val)
to Bool
val = val.toLowerCase();
return (val.equals("1") || val.equals("on") || val.equals("yes"));
booleantoBool(String val, boolean def)
to Bool
if (val == null) {
    return def;
if (val.equalsIgnoreCase("Y") || val.equalsIgnoreCase("T")) {
    return true;
} else if (val.equalsIgnoreCase("N") || val.equalsIgnoreCase("F")) {
    return false;
} else {
...