I have the following Java class:
public class ArtClassInt {
public boolean foo(int x) {
if(x == 3956681)
return true;
else
return false;
}
public boolean boo(int x) {
if(x <= 952140568)
return true;
else
return false;
}
public boolean boo1(int x, int y) {
if(x <= y)
return true;
else
return false;
}
public boolean zoo(int x) {
if(x+1 < 1267)
return true;
else
return false;
}
}
When I complied it and got its bytecode, I got the following statements that correspond to the if-statements in the source code:
ArtClassInt.boo1(II)Z: I4 Branch 3 IF_ICMPGT L17 - true
ArtClassInt.boo1(II)Z: I4 Branch 3 IF_ICMPGT L17 - false
ArtClassInt.boo(I)Z: I4 Branch 2 IF_ICMPGT L10 - true
ArtClassInt.boo(I)Z: I4 Branch 2 IF_ICMPGT L10 - false
ArtClassInt.foo(I)Z: I4 Branch 1 IF_ICMPNE L3 - true
ArtClassInt.foo(I)Z: I4 Branch 1 IF_ICMPNE L3 - false
ArtClassInt.zoo(I)Z: I6 Branch 4 IF_ICMPGE L24 - true
ArtClassInt.zoo(I)Z: I6 Branch 4 IF_ICMPGE L24 - false
I am totally confused about the mnemonics (i.e., IF_ICMPGE, IF_ICMPNE, etc). By looking at the source code, I expect that:
The if-statement in the foo method should be if_icmpeq not IF_ICMPNE
The if-statement in the boo and boo1 methods should be if_icmple not IF_ICMPGT.
The one in zoo method should be if_icmplt not IF_ICMPGE.
Can someone please explain the reason behind that?