title: How do you add data of the similar name in parallel arrays
body: <p>Been trying to figure out how to make add the data of the same numbers only so that it produce and output like this </p>
  
  <p>Total Duration
  Calls from 555-555-5555:
  555-555-5555 duration: 90s</p>
  
  <p>Calls from 555-555-1234:
  555-555-1234 duration: 56s</p>
  
  <p>Calls from 555-555-9876:
  555-555-9876 duration: 35s</p>
  
  <pre><code> public class Activity0D {
         public static void main(String[] args) {
            String[] phoneNumbers = new String[100];
            int[] callDurations = new int[phoneNumbers.length];
            int size = 0;
  
            size = addCall(phoneNumbers, callDurations, size, "555-555-5555", 40);
            size = addCall(phoneNumbers, callDurations, size, "555-555-5555", 20);
            size = addCall(phoneNumbers, callDurations, size, "555-555-5555", 30);
            size = addCall(phoneNumbers, callDurations, size, "555-555-1234", 26);
            size = addCall(phoneNumbers, callDurations, size, "555-555-1234", 30);
            size = addCall(phoneNumbers, callDurations, size, "555-555-9876", 35);
  
            System.out.println("Phone numbers (initially):");
            printList(phoneNumbers, callDurations, size);
  
  
            System.out.println("\nTotal Duration");
  
  
            System.out.println("\nEnd of processing.");
         }
  
    public static void findAllCalls(String[] phoneNumbers, int[] callDurations, int size, String targetNumber) 
     {
        int matchPos;
  
        System.out.println("Calls from " + targetNumber + ":");
        matchPos = find(phoneNumbers, size, 0, targetNumber);
        while (matchPos &gt;= 0) {
           System.out.println(phoneNumbers[matchPos] + " duration: " + callDurations[matchPos] + "s");
  
           // Find the next match, starting after the last one
           matchPos = find(phoneNumbers, size, matchPos + 1, targetNumber);
        }
     }
  
     public static void totalDurations(String[] phoneNumbers, int[] callDurations, int size)
     {
       int totalDuration = 0;
       for (int i = 0; i &lt; size; i++)
       {
         if(find(phoneNumbers, size, 0, "555-555-5555") &gt;= 0)
         {  //Add data the total duration for number "555-555-5555"
  
         }
         else if(find(phoneNumbers, size, 0, "555-555-1234") &gt;= 0)
         {     //Add data the total duration for number "555-555-1234"
         }
         else if(find(phoneNumbers, size, 0, "555-555-9876") &gt;= 0)
         {  //Add data the total duration for number "555-555-9876"
         }
       }
     }
  
  
      }
  </code></pre>