finished and tested brute.java