I need some help in converting the answers I get from my OBD adapter in my car to decimal and then later adding whatever value comes out of the conversion to a formula and printed out.
public void run() {
OBDcmds();
try {
OdbRawCommand ANS = new OdbRawCommand("22 40 90");
while (!Thread.currentThread().isInterrupted()) {
Log.d("Log", "ANS: " + ANS.getFormattedResult());
try {
ANS.run(mmInStream, mmOutStream);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("inside catch before while");
}
}
ANS when asked will return something like "6240901F30" where the first 6 numbers are irrelevant to the answer (6240901F30). So what we have left is the last (in this case) 4 numbers (1F30) which are in Hexadecimal and need to be converted to Decimal. This value is then later added to a formula x * 0,0625 - 512
. It needs to jump over those six first numbers otherwise the answer will be wrong.
How would I be able to pull this off?