/********************************************************************* * Author: Eric Heim * Date Created: 6/16/2011 * Course: CS0007 * Description: Shows how to sum the elements of an array *********************************************************************/ public class ArraySum { public static void main(String[] args) { int[] myArray = {49, 99, 23, 54, 7, 16, 82}; int sum = 0; for(int number : myArray) { sum += number; } System.out.println("The sum of the array is: " + sum); } }