title: What's the "java" way of converting chars (digits) to ints
body: <p>Given the following code:</p>
  
  <pre><code>    char x = '5';
      int a0 = x - '0'; // 0
      int a1 = Integer.parseInt(x + ""); // 1
      int a2 = Integer.parseInt(Character.toString(x)); // 2
      int a3 = Character.digit(x, 10); // 3
      int a4 = Character.getNumericValue(x); // 4
      System.out.printf("%d %d %d %d %d", a0, a1, a2, a3, a4);
  </code></pre>
  
  <p>(version 4 credited to: <a href="https://stackoverflow.com/users/381345/casablanca">casablanca</a>)</p>
  
  <p>What do you consider to be the "<em>best-way</em>" to convert a char into an int ? ("<em>best-way</em>" ~= <em>idiomatic way</em>)</p>
  
  <p>We are not converting the actual numerical value of the char, but the value of the representation. </p>
  
  <p>Eg.:</p>
  
  <pre><code>convert('1') -&gt; 1
  convert('2') -&gt; 2
  ....
  </code></pre>