title: Java: Simple Recursion Issue
body: <p>I'm extremely new to the whole idea of recursion, and it's blowing my mind a bit to be honest. I'm trying to turn this function I wrote into a recursive one...</p>
  
  <pre><code>public static int to_number(String s)
  {
      int total = 0;
      int n=s.length();
      for(int i = 0 ; i &lt; n ; i++) { 
          char c = s.charAt(i);
          if (Character.isDigit(c)){
              int value=Character.getNumericValue(c);
              total +=value;
          }
      }
      System.out.println(total);
      return total;
  }
  </code></pre>
  
  <p>It reads in a string, such as "3aaa6a3", iterates through the string, if the <code>char</code> is a digit, it adds it to total, and so on. What I have so far...</p>
  
  <pre><code>    public static int to_number(String s)
  {
      int total = 0;
      int n=s.length();
      int i=0;
      if (i == n){
          return 0; //if gone through the whole string
      }
      char c = s.charAt(i);
          if (Character.isDigit(c)){
              int value=Character.getNumericValue(c);
              total +=value;
          }
  
      System.out.println(total);
      i++;
      to_number(); //trying to call the same function
      return total;
  }
  </code></pre>
  
  <p>I feel like I'm close, but just not getting it. Thanks for your time and effort!</p>