Edmond
Edmond

Reputation: 644

How to know the byte code size of a Java method

Would like to take a look at the byte code size of a method to see how far it is to the maximum length(64KB). How could I do that?

Upvotes: 4

Views: 2532

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500225

One option is to use javap -c YourClassName - that will show you the byte offsets of each instruction for each method.

Alternatively, to do this programmatically, I strongly suspect BCEL or ASM will help you out.

Upvotes: 5

Related Questions