title: Convert aplhanumeric string to numbers- NumberFormatException
body: <p>I have to get number 23 from string "a23". When below program is run, following error is seen.</p>
  
  <pre><code>public class GetIntFromString {
  
      public static void main(String[] args) {
  
          String str = "a23";
  
          int i = Integer.parseInt(str);
  
          System.out.println("Integer value= "+i);
  
          System.out.println("value= "+str);
  
      }
  }
  </code></pre>
  
  <p>Here is the stack trace</p>
  
  <pre><code>Exception in thread "main" java.lang.NumberFormatException: For Input String: "a23"
  
  at java.lang.NumberFormatException.forInputString&lt;NumberFormatException.java.48&gt;
  at java.lang.Integer.ParseInt&lt;Integer.java.449&gt;
  at java.lang.Integer.ParseInt&lt;Integer.java.499&gt;
  at GetIntFromString.main&lt;GetIntFromString.java.9&gt;
  </code></pre>