ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.
ProGuard is useful for making code more compact and more efficient, on the desktop, on tablets, on smartphones, and on embedded devices. It also makes code more difficult to reverse engineer.
https://sourceforge.net/projects/proguard/