Utils { public static byte hexCharsToByte(String twoHexDigits) { if (twoHexDigits == null || twoHexDigits.length() != 2) { throw new IllegalArgumentException("URLDecoder: Illegal hex characters : \"" + twoHexDigits + "\""); } return hexCharsToByte(twoHexDigits.charAt(0), twoHexDigits.charAt(1)); } private  Utils(); static String resilientUrlDecode(String input); static byte hexCharsToByte(String twoHexDigits); static byte hexCharsToByte(char c1, char c2); static String decodeApacheHTTPDLogValue(String input); static String makeHTMLEncodedInert(String uriString); static String replaceString(
        final String input,
        final String searchFor,
        final String replaceWith
    );  }
@Test public void testHexToByte() { assertEquals((byte) 0x00, Utils.hexCharsToByte('0', '0')); assertEquals((byte) 0x11, Utils.hexCharsToByte('1', '1')); assertEquals((byte) 0x22, Utils.hexCharsToByte('2', '2')); assertEquals((byte) 0x33, Utils.hexCharsToByte('3', '3')); assertEquals((byte) 0x44, Utils.hexCharsToByte('4', '4')); assertEquals((byte) 0x55, Utils.hexCharsToByte('5', '5')); assertEquals((byte) 0x66, Utils.hexCharsToByte('6', '6')); assertEquals((byte) 0x77, Utils.hexCharsToByte('7', '7')); assertEquals((byte) 0x88, Utils.hexCharsToByte('8', '8')); assertEquals((byte) 0x99, Utils.hexCharsToByte('9', '9')); assertEquals((byte) 0xaa, Utils.hexCharsToByte('a', 'a')); assertEquals((byte) 0xbb, Utils.hexCharsToByte('b', 'b')); assertEquals((byte) 0xcc, Utils.hexCharsToByte('c', 'c')); assertEquals((byte) 0xdd, Utils.hexCharsToByte('d', 'd')); assertEquals((byte) 0xee, Utils.hexCharsToByte('e', 'e')); assertEquals((byte) 0xff, Utils.hexCharsToByte('f', 'f')); assertEquals((byte) 0xAA, Utils.hexCharsToByte('A', 'A')); assertEquals((byte) 0xBB, Utils.hexCharsToByte('B', 'B')); assertEquals((byte) 0xCC, Utils.hexCharsToByte('C', 'C')); assertEquals((byte) 0xDD, Utils.hexCharsToByte('D', 'D')); assertEquals((byte) 0xEE, Utils.hexCharsToByte('E', 'E')); assertEquals((byte) 0xFF, Utils.hexCharsToByte('F', 'F')); }
@Test(expected = IllegalArgumentException.class) public void testHexToByteIllegalLeft() { Utils.hexCharsToByte('X', '0'); }
@Test(expected = IllegalArgumentException.class) public void testHexToByteIllegalRight() { Utils.hexCharsToByte('0', 'X'); }