Hi,
I suggest you to use JUnit which will enable to test almost every logical statement. Using JUnit pretty easy just need to download it(it is jar file) and put it in the classpath and go through the docs. If you are using any IDE check for JUnit most of the IDEs provide Junit as a part of it.
Ashok.