title: How to create a sum of alternating integers from an int array?
body: <p>I am supposed to compute the alternating sum of all elements in an array. For example, the array with values <strong>1 4 9 16 9 7 4 9 11</strong> should compute </p>
  
  <blockquote>
    <p>1 - 4 + 9 - 16 + 9 - 7 + 4 - 9 + 11 = -2</p>
  </blockquote>
  
  <p>following code was provided by instructor </p>
  
  <pre><code> public static void main(String[] args)
   {
    double[] data = { 1, 4, 9, 16, 9, 7, 4, 9, 11 };
    AlternatingSum util = new AlternatingSum();
    double total = util.alternatingSum(data);
    System.out.println("Expected sum:  -2");
    System.out.println("Alternating sum: " + total);
   }
  </code></pre>
  
  <p>What does util.alternatingSum(data) mean? Do I have to create an alternatingSum method? And if so, what is the heading code for that method?</p>
  
  <p>Thank you for any help. </p>