Proguard
When it comes to java obfuscation and bytecode optimization, Proguard is really the cream of the crop. And it’s constantly getting better. It’s included as Netbeans default obfuscator, but the version they are shipping together with the IDE tends to not be the latest one. But you can easily download the latest proguard and just replace “proguard.jar” in the “mobilityx.x\external” directory with the new one.
However, I have encountered some problems with midlets that has been byte optimized by proguard. It’s really rare, but it can happen. If you get problems, you might need to turn bytecode optimization off. Or, you can analyze what it is in your code that gets optimized incorrectly and change it.
