Skip to content

Instantly share code, notes, and snippets.

@md-5
Last active December 10, 2015 23:08
Show Gist options
  • Save md-5/4507738 to your computer and use it in GitHub Desktop.
Save md-5/4507738 to your computer and use it in GitHub Desktop.
Java bytecode

Pseudo Java code:

public static void main(String[] args) {
    System.out.print("Enter two numbers: ");
    int x = read();
    int y = read();
    print(x / y);
}

JD-GUI output:

public static void main(String[] paramArrayOfString)
{
  paramArrayOfString = 0;
  int i = 0;
  break label91;
  int j = returnAddress;
}

Fernflower output:

   public static void main(String[] param0) {
      // $FF: Couldn't be decompiled
   }

JAD output:

    public static void main(String args[])
    {
        args = 0;
        int i = 0;
        break MISSING_BLOCK_LABEL_91;
        local;
        int i1;
        i1;
        int l;
        l;
        int j1;
        j1 = 0;
        if(l - i1 < 0)
        {
            j1 = l;
            l = i1;
            i1 = j1;
        }
        if(0 - i1 != 0)
            break MISSING_BLOCK_LABEL_59;
        l;
        JVM INSTR ret 10;
        local;
        l;
        i1;
        j1;
        l - i1;
        Object obj = i1;
        JVM INSTR swap ;
        i1;
        JVM INSTR swap ;
        l;
        JVM INSTR swap ;
        int k;
        k;
        JVM INSTR ret 10;
        int j;
        print("Enter two numbers: ");
        args = read();
        j = read();
        print((float)args / (float)j);
        return;
    }

Dava output:

Sorry, I cannot handle this method.
Considering 11: istore[11]
Exception in thread "main" java.lang.RuntimeException: TypeStack merging failed; unequal stack lengths: 7 and 3
    at soot.coffi.TypeStack.merge(TypeStack.java:137)
	at soot.coffi.CFG.jimplify(CFG.java:1196)
	at soot.coffi.CFG.jimplify(CFG.java:955)
	at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:100)
	at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:89)
	at soot.SootMethod.retrieveActiveBody(SootMethod.java:322)
	at soot.PackManager.retrieveAllBodies(PackManager.java:974)
	at soot.PackManager.runPacks(PackManager.java:338)
	at soot.Main.run(Main.java:198)
	at soot.Main.main(Main.java:141)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment