* @return String
   */
  public static String unescapeUrlString(String input) {
    if (Native.string_position(input, '%', 0) == Stella.NULL_INTEGER) {
      return (input);
    }
    else {
      { StringBuffer result = Stella.makeRawMutableString(input.length());
        int iOut = 0;
        int iIn = 0;
        char charSave = Stella.NULL_CHARACTER;
        int charValue = 0;
        int escapeValue = 0;
        int iMax = input.length();

        while (iIn < iMax) {
          if (input.charAt(iIn) == '%') {
            {
              iIn = iIn + 1;
              if (iIn < iMax) {
                {
                  charSave = input.charAt(iIn);
                  charValue = Stella.hexCharacterValue(charSave);
                  iIn = iIn + 1;
                  if ((charValue != Stella.NULL_INTEGER) &&
                      (iIn < iMax)) {
                    {
                      escapeValue = 16 * charValue;
                      charValue = Stella.hexCharacterValue(input.charAt(iIn));
                      if (charValue != Stella.NULL_INTEGER) {
                        {
                          edu.isi.stella.javalib.Native.mutableString_nthSetter(result, ((char) (escapeValue + charValue)), iOut);
                        }
                      }
                      else {
                        {
                          edu.isi.stella.javalib.Native.mutableString_nthSetter(result, '%', iOut);
                          edu.isi.stella.javalib.Native.mutableString_nthSetter(result, charSave, (iOut = iOut + 1));
                          edu.isi.stella.javalib.Native.mutableString_nthSetter(result, (input.charAt(iIn)), (iOut = iOut + 1));
                        }
                      }
                    }
                  }
                  else {
                    {
                      edu.isi.stella.javalib.Native.mutableString_nthSetter(result, '%', iOut);
                      edu.isi.stella.javalib.Native.mutableString_nthSetter(result, charSave, (iOut = iOut + 1));
                    }
                  }
                  iOut = iOut + 1;
                  iIn = iIn + 1;
                }
              }
              else {
                {
                  edu.isi.stella.javalib.Native.mutableString_nthSetter(result, '%', iOut);
                  iOut = iOut + 1;
                }
              }
            }
          }
          else {
            {
              edu.isi.stella.javalib.Native.mutableString_nthSetter(result, (input.charAt(iIn)), iOut);
              iOut = iOut + 1;
              iIn = iIn + 1;
            }
          }
        }
        return (Native.mutableString_subsequence(result, 0, iOut));
      }
    }
  }