Skip to content

Instantly share code, notes, and snippets.

@hogelog
Created March 17, 2009 10:02
Show Gist options
  • Save hogelog/80441 to your computer and use it in GitHub Desktop.
Save hogelog/80441 to your computer and use it in GitHub Desktop.
Compiled from "loop_while_for.java"
class Test extends java.lang.Object{
Test();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return
int sum_inc();
Code:
0: iconst_0
1: istore_2
2: iconst_0
3: istore_1
4: iload_1
5: sipush 1000
8: if_icmpge 21
11: iload_2
12: iload_1
13: iadd
14: istore_2
15: iinc 1, 1
18: goto 4
21: iload_2
22: ireturn
int sum_dec();
Code:
0: iconst_0
1: istore_2
2: sipush 1000
5: istore_1
6: iload_1
7: ifeq 20
10: iload_2
11: iload_1
12: iadd
13: istore_2
14: iinc 1, -1
17: goto 6
20: iload_2
21: ireturn
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment