I am trying to understand bit
and byte manipulation
and I have seen many examples in SO
. Still, I have some questions regarding my understanding.
First, lets say we have a byte array
with the byte order as Least Significant Byte
. I want to get the byte 2 from this array. I can get the byte like byte[1]
. Am I right?
Second, we have a byte array
with the byte order as Least Significant Byte
. And I want to get first 2 bits of the byte 1!. How can I get the first 2 bits from that byte?
Also, how can I add a number into the first 2 bits of a byte?
Any help or link to understand those logics are much appreciated.