Rather than using a hex editor, one might consider a tool like Soot from McGill's Sable group. It includes a DSL for dealing with bytecode:
I had looked at Soot some time ago because of Dava, the Java decompiler included with the project.
Also, for programatic manipulation of bytecode, ASM is a great tool:
It includes a Java source generator which, given a .class file as input, produces a Java source class which will regenerate the input via the ASM builder APIs. Obviously, the benefit is that you get a starting point for building various re-writers, analyzes, etc.