title: Manually converting a string to an integer in Java
body: <p>I'm having string consisting of a sequence of digits (e.g. <code>"1234"</code>).  How to return the <code>String</code> as an <code>int</code> without using Java's library functions like <code>Integer.parseInt</code>?</p>
  
  <pre><code>public class StringToInteger {
    public static void main(String [] args){
      int i = myStringToInteger("123");
      System.out.println("String decoded to number " + i);
    }
  
    public int myStringToInteger(String str){
        /* ... */
    }
  }
  </code></pre>