0
我剛剛使用Jadx
來反編譯*.apk
文件。該應用程序仍然運行良好。在Java反編譯器上查看結果:jadx導致失敗的酸碼?
public class Information extends BaseInformation implements InformationInterface {
private static final String LOG_TAG = "Information.java";
public String decimalLength;
public String expression;
public String length;
public String signed;
public String start;
public String unit;
public Information() {
this.signed = "N";
}
public String toString() {
return "information name = " + this.nameZh;
}
public boolean isSigned() {
if ("Y".equals(this.signed)) {
return true;
}
return false;
}
public String getValue() {
if (BluetoothTools.cmdArray == null || BluetoothTools.cmdArray.size() == 0) {
return this.unit;
}
int startInt = Integer.parseInt(this.start);
int lengthInt = Integer.parseInt(this.length);
int dLength = Integer.parseInt(this.decimalLength);
StringBuffer sb = new StringBuffer();
int i;
StringBuffer stringBuffer;
int i2;
if (ConfigManager.getInstance().isBigEndian()) {
for (i = (startInt + lengthInt) - 1; i >= startInt; i--) {
stringBuffer = sb;
i2 = 0;
stringBuffer.insert(i2, (String) BluetoothTools.cmdArray.get(i));
}
} else {
for (i = startInt; i < startInt + lengthInt; i++) {
stringBuffer = sb;
i2 = 0;
stringBuffer.insert(i2, (String) BluetoothTools.cmdArray.get(i));
}
}
String hexString = sb.toString();
long intValue = 0;
try {
if (isSigned()) {
intValue = new BigInteger(Hex2StringUtils.hexStringToByte(hexString)).longValue();
Log.i(LOG_TAG, "isSigned intValue: " + intValue);
} else {
intValue = Long.parseLong(hexString, 16);
}
} catch (NumberFormatException e1) {
e1.printStackTrace();
}
String value = "";
try {
BigDecimal b = new BigDecimal(new ExpressionParser().calculate(this.expression.replace("x", new StringBuilder(String.valueOf(intValue)).toString())));
if (dLength > 0) {
return new StringBuilder(String.valueOf(b.setScale(dLength, 4).doubleValue())).append(this.unit).toString();
} else if (dLength != 0) {
return value;
} else {
return new StringBuilder(String.valueOf(b.setScale(dLength, 4).intValue())).append(this.unit).toString();
}
} catch (ParserException e) {
e.printStackTrace();
return value;
}
}
}
這個類反編譯失敗嗎?
StringBuffer sb發生了什麼?
它看起來像不包含任何字符串,所以hexString
仍然爲NULL。
任何人都可以解釋我嗎?
hexString是sb的字符串 hexString = sb.toString(); 但是sb沒有插入任何地方。 –
@Sang Seu:關心'stringBuffer = sb;'任務。這意味着''stringBuffer.insert(...)'在'sb'引用的同一個對象上被調用。 – Holger
如果我不想使用'stringBuffer'這樣的工作? (i2,(String)BluetoothTools.cmdArray.get(i));'sb.insert(i2, –