Run static code analysis tool, and fix some of the detected bugs. Some static code analysis tool: SonarQube, FindBugs, VS Code Analyzer, Codacy, Coverity Scan...