Looking for a solution to resolve my problem, I've found just Hex signed to int value transformation, but not the inverse case.
I've tried this:
float grades = -32.33f ;
System.out.println("grades: "+grades);
double radians = Math.toRadians(grades);
System.out.println("rad: "+radians);
radians = radians * 100000000;
System.out.println("rad * 10^8: "+radians);
String hex = Double.toHexString(radians);
System.out.println("signed to hex: "+hex);
with output:
grados: -32.33
rad: -0.5642649791276998
rad * 10^8: -5.642649791276998E7
signed to hex: -0x1.ae8000f4d5a59p25
But I'm expecting get:
FCA30001
In this answer Java negative int to hex and back fails I found that Double.toHexString(radians);
gave me an unsgined value, may be this is the problem. Any Ideas?
Thanks in advance.
EDIT:
I'm trying do the inverse operation of:
- 1) FCA30001 to signed int is: -56426495,
- 2) -56426495*10^8 is -0.564264 radians,
- 3) Now converting radians to grades is -32.33.