Reputation: 13
I have a byte array as: 00SSSMMM
I want to retrieve SSS and MMM values as int values.
Can someone help me in implementing this in java ?
Thanks.
Upvotes: 0
Views: 47
Reputation: 533442
I think you mean
int x = ...
int m = x & 0b111;
int s = (x >> 3) & 0b111;
Upvotes: 1