Having two bytes, how to make a new byte by taking the first 3 bits from the first byte and the last 5 from the second ?
For instance, how would that for 11100000 and 00011111 ==> 11111111 ?
I am using Java.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
byte b1, b2;take first 3 bits:
b1 & 0xE0take last 5 bits:
b2 & 0x1Fconcatenate:
b1 | b2