Skip to content

Instantly share code, notes, and snippets.

@nitsanw
Created January 25, 2016 07:15
Show Gist options
  • Save nitsanw/57f136c1b85436394f8a to your computer and use it in GitHub Desktop.
Save nitsanw/57f136c1b85436394f8a to your computer and use it in GitHub Desktop.
private static long countOdds(int limit) {
long l = 0;
for (int i = 0; i < limit; i++) {
for (int j = 0; j < limit; j++) {
if ((j & 1) == 1)
l++;
}
}
return l;
}
private static long countOdds(int); | private static long countOdds(int);
descriptor: (I)J | descriptor: (I)J
flags: ACC_PRIVATE, ACC_STATIC | flags: ACC_PRIVATE, ACC_STATIC
Code: | Code:
stack=4, locals=5, args_size=1 | stack=4, locals=5, args_size=1
0: lconst_0 | 0: lconst_0
1: lstore_1 | 1: lstore_1
2: iconst_0 | 2: iconst_0
3: istore_3 | 3: istore_3
4: goto 37 | 4: iload_3
7: iconst_0 | 5: iload_0
8: istore 4 | 6: if_icmpge 42
10: goto 28 | 9: iconst_0
13: iload 4 | 10: istore 4
15: iconst_1 | 12: iload 4
16: iand | 14: iload_0
17: iconst_1 | 15: if_icmpge 36
18: if_icmpne 25 | 18: iload 4
21: lload_1 | 20: iconst_1
22: lconst_1 | 21: iand
23: ladd | 22: iconst_1
24: lstore_1 | 23: if_icmpne 30
25: iinc 4, 1 | 26: lload_1
28: iload 4 | 27: lconst_1
30: iload_0 | 28: ladd
31: if_icmplt 13 | 29: lstore_1
34: iinc 3, 1 | 30: iinc 4, 1
37: iload_3 | 33: goto 12
38: iload_0 | 36: iinc 3, 1
39: if_icmplt 7 | 39: goto 4
42: lload_1 | 42: lload_1
43: lreturn | 43: lreturn
LineNumberTable: | LineNumberTable:
line 14: 0 | line 14: 0
line 15: 2 | line 15: 2
line 16: 7 | line 16: 9
line 17: 13 | line 17: 18
line 18: 21 | line 18: 26
line 16: 25 | line 16: 30
line 15: 34 | line 15: 36
line 21: 42 | line 21: 42
LocalVariableTable: | LocalVariableTable:
Start Length Slot Name Signature | Start Length Slot Name Signature
0 44 0 limit I | 12 24 4 j I
2 42 1 l J | 4 38 3 i I
4 38 3 i I | 0 44 0 limit I
10 24 4 j I | 2 42 1 l J
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment