want to list the arrays that are even within this method. Instead of printing the actual elements, I'm printing the index that the element is in. What am I doing wrong?
public static void evenNumbers(ArrayList<Integer> temp) {
ArrayList<Integer> count = new ArrayList<Integer>();
for (int i = 0; i < temp.size(); i++) {
if (temp.get(i) % 2 == 0)
count.add(i);
}
for (int i = 0; i < count.size(); i++) {
System.out.println("The even numbers of Temperatures is: " +count.get(i));
}
}
//count.get(i) && count array list prints the index instead of the element inside the index.
//thanks everyone.