I am trying to make a method that gets the int value assigned to characters in a String, adds them up and returns a total.
It seems like the nested loops are not working properly, for some reason.
public static int tap_counter(String type) {
    String[] type_array = type.split("");
    String[] example_letters = new String[] {"A","B"}; 
    int total = 0;
    for(int i=0; i < type_array.length;i++){  
        for(int j=0; type_array[i] != standard_letters[j]; j++) 
        {
          if(type_array[i] == "A") total += 1;
          else if(type_array[i] == "B") total += 2;
        }
     }
    return total;
}
It works for a single-character String, but I get an OutOfBounds exception for multi-element Strings.
So, for instance, for the input "AB":
- expected output is 3; 
- real output: java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2. 
 
     
    