### Question:
Hex { public static String decodeHexString( String str ) throws InvalidNameException { if ( str == null || str.length() == 0 ) { throw new InvalidNameException( I18n.err( I18n.ERR_17037_MUST_START_WITH_SHARP ) ); } char[] chars = str.toCharArray(); if ( chars[0] != '#' ) { throw new InvalidNameException( I18n.err( I18n.ERR_17038_MUST_START_WITH_ESC_SHARP, str ) ); } byte[] decoded = new byte[( chars.length - 1 ) >> 1]; for ( int ii = 1, jj = 0; ii < chars.length; ii += 2, jj++ ) { int ch = ( HEX_VALUE[chars[ii]] << 4 ) + ( HEX_VALUE[chars[ii + 1]] & 0xff ); decoded[jj] = ( byte ) ch; } return Strings.utf8ToString( decoded ); } private  Hex(); static byte getHexValue( char high, char low ); static byte getHexValue( byte high, byte low ); static byte getHexValue( char c ); static String decodeHexString( String str ); static byte[] convertEscapedHex( String str ); static char[] encodeHex( byte[] data );  }### Answer:
@Test public void testDecodeHexString() throws Exception { try { assertEquals( "", Hex.decodeHexString( "" ) ); fail( "should not get here" ); } catch ( NamingException e ) { } assertEquals( "", Hex.decodeHexString( "#" ) ); assertEquals( "F", Hex.decodeHexString( "#46" ) ); try { assertEquals( "F", Hex.decodeHexString( "46" ) ); fail( "should not get here" ); } catch ( NamingException e ) { } assertEquals( "Ferry", Hex.decodeHexString( "#4665727279" ) ); }