Exemple #1
0
 public static int getValueOfNumber(Instruction ins, ConstantPoolGen cpg) {
   if (ins instanceof BIPUSH) {
     return ((BIPUSH) ins).getValue().intValue();
   } else if (ins instanceof SIPUSH) {
     return ((SIPUSH) ins).getValue().intValue();
   } else if (ins instanceof ICONST) {
     return ((ICONST) ins).getValue().intValue();
   } else if (ins instanceof LDC_W) {
     LDC_W ldcw = (LDC_W) ins;
     return Integer.valueOf(ldcw.getValue(cpg).toString());
   } else {
     return -1;
   }
 }