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!

Removing decimal point from double value

807580Oct 21 2009 — edited Oct 22 2009
This is probably pretty simple but I can't come up with an easy way of doing it. I would like to store a number of double values in an array. Unfortunately, I run out of memory and get a java.lang.OutOfMemoryError. In order to save some space, I'd like to convert this double into an integer (only in representation) and store the integer instead.

i.e. I want to take the double value 123.456 and turn it into a 123456 integer value, and store that instead.

When time comes to read the values in the array, I'd like to do the reverse.

i.e. I want to take the 123456 value and turn it to 123.456.

Thank you in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2009
Added on Oct 21 2009
18 comments
1,002 views