Here you can find the source of booleanArray2Json(boolean[] array)
static String booleanArray2Json(boolean[] array)
//package com.java2s; //License from project: Apache License public class Main { static String booleanArray2Json(boolean[] array) { 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(','); }//from w w w. java2 s . co m // set last ',' to ']': sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); } }