In the following code segment, assume that the string str has been properly declared and initialized. The code segment is intended to print the number of ings in the array animals that have str as a substring. String[] animals = {"horse", "cow", "goat", "dog", "cat", "mouse" }; int count = 0; for (int i = 0; i <= animals.length; i++) { if (animals[i].indexOf(str) >= 0) { count++; } > System.out.println(count); The code segment does not work as intended. Which of the fo ving changes should be made so the code segment works as intended? The Boolean expression in the for loop header should be changed to i < animals.length The Boolean expression in the for loop header should be changed to i< animals.length - 1. O The Boolean expression in the for loop header should be changed to i < animals[i].length O The condition in the if statement should be changed to animals().equals(str). O The condition in the if statement should be changed to animals[i].substring(str).