I'm required to look through an array of boolean values, and return True if they are all set to be true, and False if at least one is set to be false.

Essentially, i need to do this:

boolean[] test = {true,true,false,true};
return (test[0] && test [1] && test[2] && test[3]);

but i need to do it in a (for?) loop, because the size of the array is not known beforehand.

The array is already initialized elsewhere in the program, i only included it for the example, I only need to return the value off the collective array (if any are false, return false).

I have tried a couple various ways to accomplish it but none of them are working. Perhaps this is a problem someone is familiar with?


Edit: SOLVED IT. All i had to do was make a separate method that only handled the looping operation, and i was able to get the desired result.