how to coonvert decimal number in tobase 64 format.

N

naveen

Hi friends,

My requirement is how to coonvert decimal number in
tobase 64 format.

the decimal number may be of type.

Example:
123,123.456,-123,-123.556

If any one knows any java API for this and how to use please send it
me.


Thanks,
Naveen
 
R

rossum

Hi friends,

My requirement is how to coonvert decimal number in
tobase 64 format.

the decimal number may be of type.

Example:
123,123.456,-123,-123.556

If any one knows any java API for this and how to use please send it
me.


Thanks,
Naveen

1 Look up how to convert integers from base 10 to binary, octal or
hexadecimal. Repeat the same process replacing 2, 8 or 16 with 64.
This works for both integers and the integer part of real numbers.


2 For the fractional part left once you have converted the integer
part just multiply repeatedly by your base and extract the whole
number part, which might be zero. The remaining fractional part is
cycled round again until either it goes to zero or repeats.

Example, 0.3 to binary fraction:

0.3 x 2 = 0.6 -> 0
0.6 x 2 = 1.2 -> 1
0.2 x 2 = 0.4 -> 0
0.4 x 2 = 0.8 -> 0
0.8 x 2 = 1.6 -> 1
etc.

0.3 decimal = 0.010011001(1001)... binary fraction


rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top