I have an array of 8 booleans which I want to simply convert to a byte. Is there a simple way to do this? Or do I have to use for loop?
Personally I'd prefer a simple up to two lines solution if it exists.
Thanks for help.
EDIT: Possible duplicate is just one boolean to a byte, I have an array.
ANOTHER EDIT: I get a byte from a udp packet then I set the first bit (boolean) to false, then I would need to get a byte out of that again.
byte[] arr = booleanToByteArray(booleanArrayHere);