UnsignedByteUtils { public static int unsignedByteToInt(byte b) { return b & 0xFF; } private  UnsignedByteUtils(); static long unsignedIntBytesToLong(byte[] b); static long unsignedIntToLong(int i); static int unsignedShortBytesToInt(byte[] b); static int unsignedShortToInt(short s); static int unsignedByteToInt(byte b);  }
@Test public void testUnsignedByte() { byte a = 112; byte b = -4; assertEquals(112, UnsignedByteUtils.unsignedByteToInt(a)); assertEquals(252, UnsignedByteUtils.unsignedByteToInt(b)); }