What am I doing wrong when initializing a boolean array in Java, and how can I correctly set all elements to `false`?

(Been optimizing Java snippets for readability and performance — little tweaks add up over time!) Love how @prynka.chatterjee explained the manual loop! But if you’re looking for something a bit more elegant and concise — especially in a Boolean array java context — Java’s Arrays.fill() utility is your friend.

Here’s how you do it:

import java.util.Arrays;

public static Boolean[] freq = new Boolean[Global.iParameter[2]];
Arrays.fill(freq, Boolean.FALSE);

It’s cleaner, reduces boilerplate, and makes it crystal clear that you’re initializing the entire array with a consistent default value.