code: @Override
    public void visitIntInsn(int opcode, int operand) {
      if (opcode == Opcodes.NEWARRAY) {
        // instack: ... count
        // outstack: ... aref
        if (operand >= 4 && operand <= 11) {
          super.visitInsn(Opcodes.DUP); // -> stack: ... count count
          super.visitIntInsn(opcode, operand); // -> stack: ... count aref
          invokeRecordAllocation(primitiveTypeNames[operand]);
          // -> stack: ... aref
        } else {
          logger.severe(
              "NEWARRAY called with an invalid operand "
                  + operand
                  + ".  Not instrumenting this allocation!");
          super.visitIntInsn(opcode, operand);
        }
      } else {
        super.visitIntInsn(opcode, operand);
      }
    }
docs: newarray shows up as an instruction taking an int operand (the primitive element type of the
  array) so we hook it here.