Below is a list of some tools that can help you examine your Java source code for potential problems:
1. PMD from http://pmd.sourceforge.net/ License: PMD is licensed under a “BSD-style” license
PMD scans Java source code and looks for potential problems like:
Possible bugs - empty try/catch/finally/switch statements Dead code - unused local variables, parameters and private methods Suboptimal code - wasteful String/StringBuffer usage Overcomplicated expressions - unnecessary if statements, for loops that could be while loops Duplicate code - copied/pasted code means copied/pasted bugs You can download everything from here, and you can get an overview of all the rules at the rulesets index page.