package array2;

/*
 * Return the number of even ints in the given array. Note: the % "mod" 
 * operator computes the remainder, e.g. 5 % 2 is 1.
 * 
 * countEvens({2, 1, 2, 3, 4}) -> 3
 * countEvens({2, 2, 0}) -> 3
 * countEvens({1, 3, 5}) -> 0
 */

public class CountEvens {
	
	public static void main(String[] args) {
		CountEvens test = new CountEvens();
		System.out.println(test.countEvens(new int[] {2, 1, 2, 3, 4}));
		System.out.println(test.countEvens(new int[] {2, 2, 0}));
		System.out.println(test.countEvens(new int[] {1, 3, 5}));
	}
	
	public int countEvens(int[] nums) {
		  int countEven = 0;
		  
		  for (int i = 0; i < nums.length; i++) {
		      if (nums[i] % 2 == 0) countEven++;
		  }
		  return countEven;
	}
}
@@ -174,16 +174,17 @@
  3, 4%7D) 
+-
 -%3E 3%0A * 
@@ -205,16 +205,17 @@
  2, 0%7D) 
+-
 -%3E 3%0A * 
@@ -236,16 +236,17 @@
  3, 5%7D) 
+-
 -%3E 0%0A */
@@ -730,8 +730,9 @@
 en;%0A%09%7D%0A%7D
+%0A

Update CountEvens.java