title: Replace HTML codes with equivalent characters in Java
body: <p>Currently I'm working on converting HTML codes with equivalent characters in java. 
  I need to convert the below code to characters.</p>
  
  <pre><code>&amp;#x00E8; - è
  &amp;#xAE;   - ®
  &amp;#x0026; - &amp;
  &amp;#x00F1; - ñ
  &amp;#x26;   - &amp;
  </code></pre>
  
  <p>I tried using the regex pattern </p>
  
  <pre><code>(&amp;#x)([\\d|\\w]*)([\\d|\\w]*)([\\d|\\w]*)([\\d|\\w]*)(;)
  </code></pre>
  
  <p>When I debug, <code>matcher.find()</code> gives me <code>true</code> but the control skips the loop where I have written the code for conversion. Don't know what is happening there. </p>
  
  <p>Also, is there any way to optimize this regex?</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Exception</p>
  
  <pre><code>java.lang.NumberFormatException: For input string: "x26"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at org.apache.commons.lang.Entities.unescape(Entities.java:683)
        at org.apache.commons.lang.StringEscapeUtils.unescapeHtml(StringEscapeUtils.java:483)
  </code></pre>