public static byte[] instrument(byte[] originalBytes, Class<?> classBeingRedefined) {
    try {
      ClassReader cr = new ClassReader(originalBytes);
      ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES);
      VerifyingClassAdapter vcw = new VerifyingClassAdapter(cw, originalBytes, cr.getClassName());
      ClassVisitor adapter = new ConstructorClassAdapter(vcw, classBeingRedefined);

      cr.accept(adapter, ClassReader.SKIP_FRAMES);

      return vcw.toByteArray();
    } catch (RuntimeException e) {
      logger.log(Level.WARNING, "Failed to instrument class.", e);
      throw e;
    } catch (Error e) {
      logger.log(Level.WARNING, "Failed to instrument class.", e);
      throw e;
    }
  }
Given the bytes representing a class, add invocations of the ConstructorCallback method to the
constructor.

@param originalBytes the original <code>byte[]</code> code.
@param classBeingRedefined the class being redefined.
@return the instrumented <code>byte[]</code> code.
src/main/java/com/google/monitoring/runtime/instrumentation/ConstructorInstrumenter.java