[Fix] ByteHelper.getUpperNibble() was broken for signed values

This commit is contained in:
Robert von Burg 2017-12-12 14:59:09 +01:00
parent 6328827f9e
commit 23007aae2f
1 changed files with 29 additions and 29 deletions

View File

@ -247,11 +247,11 @@ public class ByteHelper {
} }
public static byte getUpperNibble(byte b) { public static byte getUpperNibble(byte b) {
return (byte) ((byte) (0xf0 & b) >> 4); return (byte) (b >>> 4 & 0x0f);
} }
public static byte getLowerNibble(byte b) { public static byte getLowerNibble(byte b) {
return (byte) (0xf & b); return (byte) (0x0f & b);
} }
/** /**