Algorithm for decimal base conversation

79 posts
Thanks Meter: 10
By alex-p690, Member on 28th August 2014, 10:54 PM
Post Reply Subscribe to Thread Email Thread
Hello guys,
For some days I'm trying to convert a double from any base to another ( tipically 2, 10 or 16), but with no luck. I thought it will be easy to find a library or some kind of an api.

I only could find convert Integer valueas or BigInteger but they had no fractional part so it is pointless. Unfortunately the Double class or the BigDecimal does not have the base convertion.

I have thought about dividing 2 numbers in that particular base, but again the BigDecimal does not have this feature like BigInteger does.

Wich is the apropiate way to this as I'm thinking about it for a couple of days and manually I'm losing way too much precision (or I implemented it poorly)?

Can you please teach me how to do this?

Thank you!

Sent from my Nexus 5 using XDA Free mobile app
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Top Threads in Java for Android App Development by ThreadRank