AspectJ (or any AOP library) could be of some use here. It allows you to define pointcuts, such as when a particular method is called (or when a field is defined among other things). You can then apply advice, which is something you do before/after the join point (the join point is where the pointcut was applied).
For example,
Apply advice that validates that the gamma value is < 100 whenever that method is called. If the value is invalid, throw an exception. If it is valid, continue as normal.
If you really want to modify individual lines of code that don't fall into the categories of what pointcuts can handle, you can use the ASM libraries as suggested by @DavidTitarenco