What do you mean? Something that strips out all of the code that you have built that you never used? Like what? Variable declarations? I think a better design would be your better option in this particular case.
If you are talking about removing unused methods of a class you could use some code obfuscators which can optimize the final class or classes bundled in a jar file