I am trying to select the lower 4 bits of the last byte in a byte array. This is how I have previously done it in PHP but I am new to Java.
$lower4bit = substr($bytes[19], -1);
//Convert the hex to decimal to get the offset value
$offset = hexdec($lower4bit);
//Select the value of the 4 bytes starting at the offset
$joinedArray = implode(array_slice($bytes, $offset, 4));
Can anyone point me in the correct direction with Java?
You access an array like so:
You find the length of an array like so:
You can isolate the last 4 bits of an integer like so:
These should be sufficient to construct the code that you need.