Created
June 21, 2019 03:17
-
-
Save codepedia/63c3fc490b66bd42aad801927f3172e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte[] IFD_Address_tmp = Arrays.copyOfRange(bytes, 4, 8); | |
int IFD_Address = 0; | |
int i = 0; | |
int shiftBy = 0; | |
for (shiftBy = 0; shiftBy < 32; shiftBy += 8) { | |
IFD_Address |= ((long) (IFD_Address_tmp[i] & 0xff)) << shiftBy; | |
i++; | |
} | |
& 0xff is required to capture the 8 bits into an integer; | |
<< shifts the bits to the left to select the appropriate place in IFD_Address; | |
|= sets the bits in IFD_Address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment