title: How to get sum of char values produced in a loop?
body: <p>Sorry if the title is misleading or is confusing, but here is my dilemma.
  I am inputting a string, and want to assign a value to each capitalized letter in the alphabet (A=1, .. Z=26) and then add the values of each letter in that string.</p>
  
  <p><strong>Example:</strong> ABCD = 10  (since 1 + 2 + 3 + 4)</p>
  
  <p>But I don't know how to add all the values in the string</p>
  
  <p><strong>NOTE</strong>: This is only for <strong>capitalized</strong> letters and strings</p>
  
  <pre><code>public class Test {
  
      public static void main(String[] args) {
  
          Scanner scannerTest = new Scanner(System.in);
          System.out.println("Enter a name here: ");
  
          String str = scannerTest.nextLine();
  
          char[] ch = str.toCharArray();
          int temp_integer = 64;
  
          for (char c : ch) {
              int temp = (int) c;
  
                 if (temp &lt;= 90 &amp; temp &gt;= 65){
              int sum = (temp - temp_integer);
              System.out.println(sum);
          }   
        }
      }
  }
  </code></pre>
  
  <p>So, as you can see I print out the sum for each time its looped,
  meaning: if I input "AB", the output will be 1 and 2.</p>
  
  <p>However, I want to go a step further, and add these two values together, but I'm stumped, any suggestions or help? (<strong>NOTE:</strong> this is not a assignment or anything, just practising problem sets)</p>