Java Boolean Convert to booleanArrayToString(boolean[] array)

Here you can find the source of booleanArrayToString(boolean[] array)

Description

Creates a string representation of the given array of type boolean[].

License

Open Source License

Parameter

Parameter Description
array the array

Return

string representation of the given array

Declaration

public static String booleanArrayToString(boolean[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from w  w w . ja  v a 2  s.co m
     * Creates a string representation of the given array of type boolean[].
     * @param array the array
     * @return string representation of the given array
     */
    public static String booleanArrayToString(boolean[] array) {
        StringBuffer sb = new StringBuffer();
        sb.append("[");
        for (boolean a : array) {
            sb.append((a ? 1 : 0) + ", ");
        }
        if (sb.lastIndexOf(", ") != -1)
            sb.delete(sb.lastIndexOf(", "), sb.length());
        sb.append("]");
        return sb.toString();
    }
}

Related

  1. boolean2long(boolean b)
  2. booleanArrayToBitString(final boolean[] booleanArray)
  3. booleanArrayToBytes(boolean[] input)
  4. booleanArrayToInt(boolean[] in)
  5. booleanArrayToIntIndexes(boolean[] arrb)
  6. booleanArrayToString(boolean[] b, String delim)
  7. booleanArrayToString(boolean[] ba)
  8. booleanToBasicType(boolean b, Class clazz)
  9. booleanToDouble(boolean b)