Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

convert double to hex string

807603Dec 9 2007 — edited Dec 9 2007
I am new to java programming and need help to convert different types to hex string in java: ( then send the string to C message queue )

For the char[] "012" -> ascii string 303132
integer 178 -> ascii string 000000B2, which I can use Integer.toHexString,
but for double 1234.56, the c converted struct is *[40934A3D70A3D70A]*
while Double.toHexString is *[0x1.34a3d70a3d70ap10]*,

How do I know the rule to get the correct one *[40934A3D70A3D70A]*?
or the struct depends on the OS ? i am using SunOS 5.8 sparc SUNW,Sun-Fire-V440

Thx.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 6 2008
Added on Dec 9 2007
4 comments
1,293 views