I wanted to format Java code so that i can extract conditions associated with if and while.

Conditions like:

```
if (condition1 && condition2) { /* Statements; */ }

```

should be like:

```
if (condition1 && condition2)
{
//Statements;
}

```

This way conditions associated with if can be fetched.

I wanted to do this using Java so i am not using any parsing tools.
I also do not want to format code using eclipse.

Thanks in advance.