Java Utililty Methods Boolean Array Convert to

List of utility methods to do Boolean Array Convert to

Description

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

Method

intbooleanArray2int(boolean[] b)
boolean Arrayint
int result = 0;
for (int i = 0; i < b.length; i++) {
    if (b[i]) {
        result += Math.pow(2, i);
return result;
StringbooleanArray2Json(boolean[] array)
boolean Array Json
if (array.length == 0)
    return "[]";
StringBuilder sb = new StringBuilder(array.length << 4);
sb.append('[');
for (boolean o : array) {
    sb.append(Boolean.toString(o));
    sb.append(',');
sb.setCharAt(sb.length() - 1, ']');
return sb.toString();