code: private static void appendDecoded(final StringBuilder builder,
                                        final String str,
                                        final int index) {
  
          if (index > str.length() - 3) {
              throw new IllegalStateException("Invalid percent-encoded string:"
                      + "\"" + str + "\".");
          }
  
          char first = str.charAt(index + 1);
          char second = str.charAt(index + 2);
  
          char decoded = (char) ((fromHex(first) << 4) | fromHex(second));
          builder.append(decoded);
      }
docs: Decodes the percent-encoded character at the given index in the string
  and appends the decoded value to the given {@code StringBuilder}.
  
  @param builder the string builder to append to
  @param str the string being decoded
  @param index the index of the '%' character in the string