title: Parsing a Hexadecimal String to an Integer throws a NumberFormatException?
body: <p>So, In Java, you know how you can declare integers like this:</p>
  
  <pre><code>int hex = 0x00ff00;
  </code></pre>
  
  <p>I thought that you should be able to reverse that process. I have this code:</p>
  
  <pre><code>Integer.valueOf(primary.getFullHex());
  </code></pre>
  
  <p>where primary is an object of a custom Color class. It's constructor takes an Integer for opacity (0-99) and a hex String (e.g. <code>00ff00</code>).</p>
  
  <p>This is the <code>getFullHex</code> method:</p>
  
  <pre><code>public String getFullHex() {
      return ("0x" + hex);
  }
  </code></pre>
  
  <p>When I call this method it gives my this <code>NumberFormatException</code>:</p>
  
  <pre><code>java.lang.NumberFormatException: For input string: "0xff0000"
  </code></pre>
  
  <p>I can't understand what's going on. Can someone please explain?</p>