Buggy code:
public class ClassFileModel { int magic ; int minorVersion ; int majorVersion ; int constantPoolCount ; ConstantInfo [ ] constantPool = new ConstantInfo [ constantPoolCount ] ; List < ClassFileModel . AccessFlag > accessFlags ; int thisClass ; int superClass ; int interfacesCount ; int [ ] interfaces = new int [ interfacesCount ] ; int fieldsCount ; FieldInfo [ ] fields = new FieldInfo [ fieldsCount ] ; int methodsCount ; MethodInfo [ ] methods = new MethodInfo [ methodsCount ] ; int attributesCount ; AttributeInfo [ ] attributes = new AttributeInfo [ attributesCount ] ; public static ClassFileModel fromBytes ( byte [ ] bytes ) { final ClassFileModel classFileModel = new ClassFileModel ( ) ; int offset = 0 ; classFileModel . magic = ByteBuffer . wrap ( bytes , offset , 4 ) . getInt ( ) ; offset += 4 ; classFileModel . minorVersion = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; classFileModel . majorVersion = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; classFileModel . constantPoolCount = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; <START_BUG> classFileModel . constantPool = new ConstantInfo [ ( classFileModel . constantPoolCount ) - 1 ] ; <END_BUG> for ( int i = 1 ; i < ( classFileModel . constantPoolCount ) ; i ++ ) { classFileModel . constantPool [ i ] = ConstantInfo . readBytes ( bytes , offset ) ; offset += classFileModel . constantPool [ i ] . getReadBytes ( ) ; if ( ( CONSTANT_DOUBLE . equals ( classFileModel . constantPool [ i ] . getTag ( ) ) ) || ( CONSTANT_LONG . equals ( classFileModel . constantPool [ i ] . getTag ( ) ) ) ) { i ++ ; } } classFileModel . accessFlags = ClassFileModel . AccessFlag . fromByte ( bytes , offset ) ; offset += 2 ; classFileModel . thisClass = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; assert ( classFileModel . constantPool [ classFileModel . thisClass ] ) instanceof ConstantClassInfo ; classFileModel . superClass = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; assert ( classFileModel . constantPool [ classFileModel . superClass ] ) instanceof ConstantClassInfo ; classFileModel . interfacesCount = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; classFileModel . interfaces = new int [ classFileModel . interfacesCount ] ; for ( int i = 0 ; i < ( classFileModel . interfacesCount ) ; i ++ ) { classFileModel . interfaces [ i ] = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; assert ( classFileModel . constantPool [ classFileModel . interfaces [ i ] ] ) instanceof ConstantClassInfo ; offset += 2 ; } classFileModel . fieldsCount = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; classFileModel . fields = new FieldInfo [ classFileModel . fieldsCount ] ; for ( int i = 0 ; i < ( classFileModel . fieldsCount ) ; i ++ ) { classFileModel . fields [ i ] = FieldInfo . fromInfoBytes ( bytes , offset , classFileModel . constantPool ) ; offset += classFileModel . fields [ i ] . getReadBytes ( ) ; } classFileModel . methodsCount = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; classFileModel . methods = new MethodInfo [ classFileModel . methodsCount ] ; for ( int i = 0 ; i < ( classFileModel . methodsCount ) ; i ++ ) { classFileModel . methods [ i ] = MethodInfo . fromInfoBytes ( bytes , offset , classFileModel . constantPool ) ; offset += classFileModel . methods [ i ] . getReadBytes ( ) ; } classFileModel . attributesCount = ByteBuffer . wrap ( bytes , offset , 2 ) . getShort ( ) ; offset += 2 ; classFileModel . attributes = new AttributeInfo [ classFileModel . attributesCount ] ; for ( int i = 0 ; i < ( classFileModel . attributesCount ) ; i ++ ) { classFileModel . attributes [ i ] = AttributeInfo . fromInfoBytes ( bytes , offset , classFileModel . constantPool ) ; offset += classFileModel . attributes [ i ] . getReadBytes ( ) ; } return classFileModel ; } public enum AccessFlag { ACC_PUBLIC ( 1 ) , ACC_FINAL ( 16 ) , ACC_SUPER ( 32 ) , ACC_INTERFACE ( 512 ) , ACC_ABSTRACT ( 1024 ) , ACC_SYNTHETIC ( 4096 ) , ACC_ANNOTATION ( 8192 ) , ACC_ENUM ( 16384 ) ; private final int value ; AccessFlag ( int value ) { } public int getValue ( ) { } private static final Set < ClassFileModel . AccessFlag > enumSet = EnumSet . allOf ( ClassFileModel . AccessFlag . class ) ; public static List < ClassFileModel . AccessFlag > fromByte ( final byte [ ] bytes , final int offset ) { } } }

Fix:
classFileModel . constantPool = new ConstantInfo [ classFileModel . constantPoolCount ] ;