A brute force example in java