Get the code at http://javagamesfactory.org/views/view-sourcesnippet?id=7
This is a utility which dumps the sizes of various parts of the internals of a class file. It lists the total sizes taken by the constant pool, fields, methods and attributes, as well as per-field and -method sizes. It helps to understand some of the structure of the class file format (in particular, what kind of information is stored in the constant pool) to get the most out of this tool.
At some point I may improve this so that it shows a more detailed view of the constant pool.
Obviously this is mostly useful for the Java 4k contest and the LWJGL 16k contest…
Sample output:
Class: com/volatileengine/util/Screenshot
Superclass: java/lang/Object
Constant pool: 1270
Fields: 0
Methods: 513
void <clinit>(): 132
Code: 124
ExceptionTable: 8
LineNumberTable: 40
LocalVariableTable: 18
void <init>(): 61
Code: 53
LineNumberTable: 12
LocalVariableTable: 18
void capture(java.lang.String,boolean): 163
Code: 155
LineNumberTable: 44
LocalVariableTable: 48
void capture(): 157
Code: 149
LineNumberTable: 40
LocalVariableTable: 28
Attributes: 8
SourceFile: 8
(obviously here debug information can be stripped to significantly cut down the file size)