@Test public void testSingleDigits() { byte[] digits = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; for (int i = 0; i < digits.length; ++i) { String str = Strings.byteToUnsignedHexString(digits[i]); String expected = "0x0" + (i+1); Assert.assertTrue( "Expecting '" + expected + "', got '" + str + "'.", str.equals("0x0" + (i + 1)) ); } }
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);  }