@Test public void testHighBits() { byte a_1 = -1; byte a_2 = -2; byte a_128 = -128; byte a_127 = -127; String str_1 = Strings.byteToUnsignedHexString(a_1); String str_2 = Strings.byteToUnsignedHexString(a_2); String str_128 = Strings.byteToUnsignedHexString(a_128); String str_127 = Strings.byteToUnsignedHexString(a_127); Assert.assertTrue( "Expecting '0xFF', got '" + str_1 + "'.", str_1.equals("0xFF") ); Assert.assertTrue( "Expecting '0xFE', got '" + str_2 + "'.", str_2.equals("0xFE") ); Assert.assertTrue( "Expecting '0x80', got '" + str_128 + "'.", str_128.equals("0x80") ); Assert.assertTrue( "Expecting '0x81', got '" + str_127 + "'.", str_127.equals("0x81") ); }
public static String byteToUnsignedHexString(byte b) { int value = b; value &= 0xFF; return ( value < 16 ? "0x0" + toUpperCase(Integer.toHexString(value)) : "0x" + toUpperCase(Integer.toHexString(value))); }
Strings { public static String byteToUnsignedHexString(byte b) { int value = b; value &= 0xFF; return ( value < 16 ? "0x0" + toUpperCase(Integer.toHexString(value)) : "0x" + toUpperCase(Integer.toHexString(value))); } }
Strings { public static String byteToUnsignedHexString(byte b) { int value = b; value &= 0xFF; return ( value < 16 ? "0x0" + toUpperCase(Integer.toHexString(value)) : "0x" + toUpperCase(Integer.toHexString(value))); } private  Strings(); }
Strings { public static String byteToUnsignedHexString(byte b) { int value = b; value &= 0xFF; return ( value < 16 ? "0x0" + toUpperCase(Integer.toHexString(value)) : "0x" + toUpperCase(Integer.toHexString(value))); } private  Strings(); static String byteToUnsignedHexString(byte b); static String bytesToHex(byte[] bytes); static String toUpperCase(String str); static String toLowerCase(String str); static int convertPollingIntervalString(String pollingInterval); }
Strings { public static String byteToUnsignedHexString(byte b) { int value = b; value &= 0xFF; return ( value < 16 ? "0x0" + toUpperCase(Integer.toHexString(value)) : "0x" + toUpperCase(Integer.toHexString(value))); } private  Strings(); static String byteToUnsignedHexString(byte b); static String bytesToHex(byte[] bytes); static String toUpperCase(String str); static String toLowerCase(String str); static int convertPollingIntervalString(String pollingInterval);  }