List of utility methods to do Boolean Array Convert to
int | booleanArray2int(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; |
String | booleanArray2Json(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(); |