I have a byte array and I would like to print the value every two bytes, and convert every two bytes to integer.
00 0f 00 13
will be printed as:
15 , 19
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.
short x = (array[0] << 8 | array[1]);
This or some permutation for C# will convert the first two bytes to a short. You can then add 2 to each of the indices until you increment through.
Apologies for incompleteness, I’m doing this on my Mac :).