.class public Factorial .super java/lang/Object .method public ()V aload 0 invokenonvirtual java/lang/Object/()V return .end method .method public static factorial(I)I ; calc `given`! .limit locals 3 .limit stack 2 ; note that parameters are automatically stored as ; local variables, we dont need to do `istore 0` to ; store the given integer in a local variable. bipush 1 ; we start calculating with `p`=1 istore 1 ; store `p` bipush 2 ; we start calculating with `j`=1 istore 2 ; store `j` loop: ; p *= j iload 1 ; load p iload 2 ; load j imul ; multiply p and j istore 1 ; store p*j in p ; j++ iload 2 ; load j bipush 1 ; put a 1 on the stack iadd ; add j and 1 istore 2 ; store j+1 in j ; if j