public byte[] getImage() {
    ByteArrayOutputStream image=new ByteArrayOutputStream();

    try {
      finishMethod(); // finish the last method

      // patch methods count
      int otsize=tsize;
      tsize=nMethodsPatch;
      writeShort(nMethods);
      tsize=otsize;

      // assemble the method bytecode
      image.write(prologue);
      image.write((poolEntries >>> 8) & 0xFF);
      image.write((poolEntries >>> 0) & 0xFF);
      constPoolData.writeTo(image);
      image.write(text,0,tsize);
      image.write(0); // no class file attributes      
      image.write(0); // no class file attributes      
    } catch (IOException exc) {
      // can't be
    };
    return image.toByteArray();
  };