Convert integer to binary then each binary character to boolean
I need to convert an int, say 90, to a binary number (1011010), then i need to separate each digit and save it as a true or false boolean.
(true, false, true, true, false, true, false).
so far :
a = Integer.toBinaryString(int b);
Any help is appreciated.
Re: Convert integer to binary then each binary character to boolean
all roads lead to Rome... do you have no idea?
1. the boolean array must have the same size as the string -> boolean array = new boolean[a.length()];
2. the string class has useful methods, like charAt(index) or toCharArray() to get each digit
3. if the digit is == '1' -> save true in your boolean array on position 'index'
or or or ...