public static String decodeXmlCharRef(String digits) {
    { int n = 0;
      int end = digits.length() - 2;

      if (digits.charAt(2) == 'x') {
        { int i = Stella.NULL_INTEGER;
          int iter000 = 3;
          int upperBound000 = end;
          boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;

          for (;unboundedP000 ||
                    (iter000 <= upperBound000); iter000 = iter000 + 1) {
            i = iter000;
            n = (n * 16) + Stella.hexCharacterValue(digits.charAt(i));
          }
        }
      }
      else {
        { int i = Stella.NULL_INTEGER;
          int iter001 = 2;
          int upperBound001 = end;
          boolean unboundedP001 = upperBound001 == Stella.NULL_INTEGER;

          for (;unboundedP001 ||
                    (iter001 <= upperBound001); iter001 = iter001 + 1) {
            i = iter001;
            n = (n * 10) + Stella.digitValue(digits.charAt(i));
          }
        }
      }
      return (Native.makeString(1, (char) n));
    }
  }