Hello,
I am reading some date via SNMP, the problem is that the answer is hexadecimal (from right to left) so I get answers like 00 00 10 42
In Java I am doing this to get the correct value
I am reading some date via SNMP, the problem is that the answer is hexadecimal (from right to left) so I get answers like 00 00 10 42
In Java I am doing this to get the correct value
Code:
static String hex2StringRightToLeft(String octetString) {
octetString = octetString.replace(":", "");
String s = "";
for (int i = 0; i < octetString.length(); i++) {
s = octetString.substring(i,i+2) + s;
i++;
}
return String.valueOf(Float.intBitsToFloat(Integer.parseInt(s, 16)));
}
Comment