How to add code to compiled java class

Table of Contents

I have java code that is compiled to a .class file. There is a function that gets few parameters and do some action (e.g. get int x and int y and do x+y)

I want to add to this .class file code that checks if x=1 and call to another function(e.g. call to x-y and don't do x+y)

How can edit a compiled .class file and add my own code?

Source: Reverse Engineering Stack Exchange

Related Articles