title: Java - Convert hex to decimal - make a string = the correct number
body: <p><strong>ERROR WAS DUE TO A MISTAKE WHICH WAS OVERLOOKED</strong></p>
  
  <p>I recently created a Java program that converts an rgb value to hexadecimal.  Now I am trying to make a program that will do the opposite.  I already figured out the algorithm I am going to use, I just need to convert the characters <code>A - F</code> to the values <code>10 - 15</code>.  Seems simple right?  This is where I hit my problem.</p>
  
  <p>Here is the code I have so far.  A string is fed into <code>nums()</code> which then checks it against the array <code>abc</code>.  Once a match is found it takes takes the string <code>a</code> and converts it to an integer, then takes <code>i</code> and will add 10 in order to get the right number.</p>
  
  <pre><code>class TextToNum {
    String[] abc = { "A", "B", "C", "D", "E", "F" };
    public int nums(String a) {
      for(int i = 0; i &lt; abc.length; i++) {
        if (a == abc[i]) {
          a = Integer.parseInt(a.trim());
          a = i + 10;
        }
      }
      return a;
    }
  }
  </code></pre>
  
  <p>The errors I get are:</p>
  
  <pre><code>gbConv.java:52: incompatible types
  found   : int
  required: java.lang.String
                  a = Integer.parseInt(a.trim());
                                      ^
  rgbConv.java:53: incompatible types
  found   : int
  required: java.lang.String
                  a = i + 10;
                        ^
  rgbConv.java:56: incompatible types
  found   : java.lang.String
  required: int
          return a;
                 ^
  </code></pre>
  
  <p>It is obvious that something is wrong with the <code>Integer.parseInt()</code> but I am not sure how to fix it.  I have been looking on the web and I can't find anything.  Any suggestions / tutorials would be a great help.</p>