// // Copyright (C) 2004 Boretti Mathieu // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // // This class sum all argument of the Main and Divide by the number of argument // // // // Define a class named "org.boretti.asm2class.example.moyenne" // Lorg/boretti/asm2class/example/moyenne; : // // Define a method named "main" with String [] as parameter and no // return value. This method is public and static // * . main ([Ljava/lang/String;)V : fconst_0 // 0.0 fstore_1 // iconst_0 // 0 istore_2 // aload_0 // a arraylength // dup // ifeq FIN // SUM : dup // iload_2 // <2> if_icmple MOYENNE // aload_0 // a iload_2 // a <2> aaload // s invokestatic Ljava/lang/Float; (Ljava/lang/String;)Ljava/lang/Float; valueOf // F invokevirtual Ljava/lang/Float; ()F floatValue // 1 // f fload_1 // f <1> fadd // f fstore_1 // iinc 2 1 // goto SUM // MOYENNE : fload_1 // f swap // f i2f // f f fdiv // f getstatic Ljava/lang/System; out Ljava/io/PrintStream; // f out swap // out f invokevirtual Ljava/io/PrintStream; (F)V println // return // FIN : pop // return //