title: How to turn a char(0-9) into int in java?
body: <pre><code>char c = '7';
  int i = c - '0';
  
  // Here value of '0' is 48 and c = '7' is 55. Therefore, i = 55 - 48 or 7;
  </code></pre>
  
  <p>More example:</p>
  
  <pre><code>String s = "453467"
  </code></pre>
  
  <p>Here, you may need the integer value located at 3rd cell.
  You can first make a char variable. Then convert the char variable into an int.</p>
  
  <pre><code>char c = s.charAt(3);
  int i = c - '0';
  </code></pre>
  
  <p>Sometimes this thing is needed for solving programming problems and to take the input from the user as an string.</p>
  
  <p>Can you tell me the other ways to convert them. This will be very helpful for me to solve problems. THANKS!!</p>