我想选择字节数组中最后一个字节的低4位。这是我以前在PHP中完成的,但我是Java新手。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));
任何人都可以用Java指出正确的方向吗?
我没有时间得到完整的答案,但请记住......在PHP中,“数组”是数组,列表,地图和其他所有东西。在Java中,它们并不是全部合而为一。 – corsiKa
即使在PHP中,这也是非常错误的做法。 '$ lower4bit = $ bytes [19] & 0x0F;' – Esailija