I'm having trouble converting a hexadecimal number in a String to a long and then back again. Here's the code I'm using:
private void parseExperiment(){
String str1 = "AA0F245C";
long nr = Long.parseLong(str1, 16);
String str2 = Double.toHexString(nr);
}
I want str2 to be the same as str1 but when I print str1, nr and str2 I get this:
str1: AA0F245C
nr: 2853119068
str2: 0x1.541e48b8p31
Anyone knows how to fix this?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With