// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Arrays;

public class CountOddEven {
    public static void main(String[] args) {
        int[] nums = { 5, 7, 2, 4, 9 };
        System.out.println("Original array: " + Arrays.toString(nums)); 
        int[] modTwo = new int[2];
        for(int elm : nums) {
            modTwo[elm % 2]++;
        }
        System.out.println("Number of even numbers : " + modTwo[0]);
        System.out.println("Number of odd numbers : " + modTwo[1]);
    }
}
