2
How can I transform a Boolean array, boolean[] bits in his Integer correspondent?
I have a function that does exactly the opposite, but I didn’t understand it enough to be able to reverse it.
int input = 62;
boolean[] bits = new boolean[7];
for (int i = 6; i >= 0; i--) {
bits[i] = (input & (1 << i)) != 0;
}
System.out.println(input + " = " + Arrays.toString(bits));
//saída: 62 = [false, true, true, true, true, true, false]
How can I get this array bits of example and have it as Integer returning the value 62 of input again?
I wavered in the answer. This gives not reading the question right.
– Jéf Bueno
I was commenting :x ahaha, I even edited the question, I may have expressed myself badly
– Paulo H. Hartmann