Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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.