Java Utililty Methods Boolean Convert to

List of utility methods to do Boolean Convert to

Description

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

Method

StringbooleanArrayToString(boolean[] b, String delim)
boolean Array To String
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
    if (sb.length() > 0) {
        sb.append(delim);
    sb.append(b[i] ? "T" : "F");
return sb.toString();
...
StringbooleanArrayToString(boolean[] ba)
Utility to convert a boolean[] to a String.
if (ba == null) {
    return "null";
StringBuilder sb = new StringBuilder("[");
for (int i = 0; i < ba.length; ++i) {
    sb.append(ba[i] ? 'Y' : 'N');
sb.append(']');
...
TbooleanToBasicType(boolean b, Class clazz)
boolean To Basic Type
if (clazz.equals(Boolean.class))
    return (T) Boolean.valueOf(b);
if (clazz.equals(Byte.class))
    return (T) Byte.valueOf(booleanToByte(b));
if (clazz.equals(Character.class))
    return (T) Character.valueOf(booleanToChar(b));
if (clazz.equals(Short.class))
    return (T) Short.valueOf(booleanToShort(b));
...
doublebooleanToDouble(boolean b)
boolean To Double
return b ? 1. : 0.;
StringbooleanToStr(boolean bool)
boolean To Str
if (bool) {
    return "Yes";
} else {
    return "No";
intbooleanToTinyInt(boolean b)
MySQL boolean to tinyint.
if (b) {
    return (1);
} else {
    return (0);
StringbooleanToYesNo(Boolean b)
Returns "Y" for true and "N" for false
return b.booleanValue() ? "Y" : "N";
intboolToNum(Boolean bool)
Converts a Boolean value to int value
int num = 0;
if (bool.booleanValue()) {
    num = 1;
return num;
StringBoolToNum(boolean bool)
Bool To Num
return bool ? "1" : "0";
byteboolToNumber(boolean aBoolean)
Converts a boolean to a number, according to the lobby protocol standard.
return (aBoolean ? ((byte) 1) : ((byte) 0));