I wrote this program and I want to read a binary String and write each 0 or 1 to a Boolean array.
but I don't know why the program encounters a problem when I want to scan from String.
but I don't know why the program encounters a problem when I want to scan from String.
Code:
String String1;
Boolean[] Num1 = new Boolean[32];
int count1;
Scanner in = new Scanner(System.in);
String1 = in.next();
Scanner inString1 = new Scanner(String1);
for(count1 = 0;inString1.hasNextBoolean();count1++)
Num1[count1] =inString1.nextBoolean();
Comment