i have an intetger var, and i'm trying to get specific bytes from them.
int foo= 67;
byte b = new byte; // int has 4 bytes in java
b = foo | 1 << (7-8); // should give me the first 8 bits of foo but not working, probably doing it wrong.
i'm basically trying to extract the bits 0-7, 8-15, and so on and store them in my array of byte.
Any pointers would help, i am weak when it comes to bit manipulation.
0 · ·