westbow% cat Demo.java class Demo { public static int pi(int n){ int a = 0; while (n!=0){a=a+1;n=n-2;}; return a; } public static void main(String[] args){ int n = Integer.parseInt(args[0], 10); int a = pi(n); System.out.println(a); } } westbow% javac Demo.java westbow% javap -c Demo Compiled from "Demo.java" class Demo extends java.lang.Object{ Demo(); Code: 0: aload_0 1: invokespecial #1; //Method java/lang/Object."":()V 4: return public static int pi(int); Code: 0: iconst_0 1: istore_1 2: iload_0 3: ifeq 17 6: iload_1 7: iconst_1 8: iadd 9: istore_1 10: iload_0 11: iconst_2 12: isub 13: istore_0 14: goto 2 17: iload_1 18: ireturn public static void main(java.lang.String[]); Code: 0: aload_0 1: iconst_0 2: aaload 3: bipush 10 5: invokestatic #2; //Method java/lang/Integer.parseInt:(Ljava/lang/String;I)I 8: istore_1 9: iload_1 10: invokestatic #3; //Method pi:(I)I 13: istore_2 14: getstatic #4; //Field java/lang/System.out:Ljava/io/PrintStream; 17: iload_2 18: invokevirtual #5; //Method java/io/PrintStream.println:(I)V 21: return } westbow% java Demo 246 123 westbow% java Demo 245 % westbow%