Reputation: 667
I decompiled a .jar
file using jd-gui
and checked codes, I found it different from original .java
file.
original code
if ( total != 0 ) {
result[ i ] = bdResult.multiply( bdItem ).divide( bdTotal, 0,
RoundingMode.DOWN ).setScale( 0, RoundingMode.DOWN ).intValue();
}
decompiled code
if (total == 0)
continue;
result[i] = bdResult.multiply(bdItem).divide(bdTotal, 0,
RoundingMode.DOWN).setScale(0, RoundingMode.DOWN).intValue();
Why this happens?
In addition, decompiled code seems grammatically wrong( where curly bracket goes?)
Upvotes: 2
Views: 3144
Reputation: 326
Decompile code always tries to do the same thing as the source code, but are written in a different way because of the optimizations of the compiler. They are some decompiler that are better than other, check that article
Upvotes: 1
Reputation: 36
It's impossible to get the original code by decompiling just because different code can lead to the same java byte code statements. However, you are getting an equivalent version which performs exactly the same actions as the original.
Upvotes: 2