public static int[] booleanToBinary(boolean[] b) {
    int[] arr = new int[b.length];
    for(int i = 0; i < b.length; i++) {
        if(b[i] == true) {
             arr[i] = 1;
        }
        else{arr[i] = 0;};
        }
    
    return arr;
}
public static int binaryToInt(boolean[] b) {
    int[] a = booleanToBinary(b);
    String c = Arrays.toString(a);
    System.out.println(c);
    int decimal = Integer.parseInt(c, 2);
    
        System.out.println(decimal);
    
    
    return decimal;
    
}
 public static void main(String[] args) {
    boolean[] test = {false, true, false, true};
    System.out.println(Arrays.toString(booleanToBinary(test)));
    System.out.println(binaryToInt(test));
    
}
Blockquote I'm trying to turn the binary value into an Integer value, and I'm trying to do that using the binaryToInt method, and an NumberExceptionFormat is happening, I know that this error happens when java cannot convert a String into an Integer, can someone help me to fix this this error
 
     
    