public class ForEachWithArrays1 { public static void main(String[] args) { int[] list = new int[3]; list[0] = 7; list[1] = 22; list[2] = 13; System.out.println(FindSum(list)); } // This method uses a for-each loop to return the // sum of the elements in an integer array static int FindSum(int[] nums) { int answer = 0; for (int i : nums) answer += i; return answer; } }