This is not necessarily wrong but it can represent a [code smell][1].

The basic scenario that should be avoided regarding boolean parameters is:

<!-- language-all: java -->

 public void foo(boolean flag) {
 doThis();
 if (flag)
 doThat();
 }

Then when calling you'd typically call `foo(false)` and `foo(true)` depending on the exact behavior you want.

**This is really a problem because it's a case of bad cohesion. You're creating a dependency between methods that is not really necessary.**

What you should be doing in this case is leaving `doThis` and `doThat` as separate and public methods then doing:

 doThis();
 doThat();

or

 doThis();

That way you leave the correct decision to the caller (exactly as if you were passing a boolean parameter) without create coupling.

Of course not all boolean parameters are used in such bad way but it's definitely a code smell and you're right to get suspicious if you see that a lot in the source code.

This is just one example of how to solve this problem based on the examples I wrote. There are other cases where a different approach will be necessary.

There is a good [article from Martin Fowler][2] explaining in further details the same idea.

PS: if method `foo` instead of calling two simple methods had a more complex implementation then all you have to do is apply a small refactoring [extracting methods][3] so the resulting code looks similar to the implementation of `foo` that I wrote.


 [1]: https://stackoverflow.com/questions/6107221/at-what-point-does-passing-a-flag-into-a-method-become-a-code-smell
 [2]: http://martinfowler.com/bliki/FlagArgument.html
 [3]: http://www.refactoring.com/catalog/extractMethod.html