Recently on a coding test , I was given a problem to write a program
that converts an integer to any given base between 2 and 16
(inclusive). I had written it in C# as this code is available to
viewers at
http://www.thinkanddone.com/prog/cs/integer2decimal.html
Hope it finds it use for someone facing the same problem
Asad
Roedy Green - 20 Mar 2008 09:38 GMT
On Thu, 20 Mar 2008 01:11:58 -0700 (PDT), Dexter
<yousaf.asad@gmail.com> wrote, quoted or indirectly quoted someone who
said :
>Recently on a coding test , I was given a problem to write a program
>that converts an integer to any given base between 2 and 16
>(inclusive). I had written it in C# as this code is available to
>viewers at
the code is built in to java. See
http://mindprod.com/jgloss/radix.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Lasse Reichstein Nielsen - 20 Mar 2008 14:12 GMT
> Recently on a coding test , I was given a problem to write a program
> that converts an integer to any given base between 2 and 16
> (inclusive).
...
> Hope it finds it use for someone facing the same problem
I would recommend anyone with the same problem to think it over
and find their own solution. And anyone who only needs to convery,
not write a program to convert, to use the one built into the
language. It was made by experts.
It can be done *much* shorter than what you have done.
<URL:http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Integer.html#toString(int, int)>
Example source here:
<URL:http://www.docjar.com/html/api/java/lang/Integer.java.html>
/L

Signature
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Dexter - 20 Mar 2008 22:41 GMT
> > Recently on a coding test , I was given a problem to write a program
> > that converts an integer to any given base between 2 and 16
[quoted text clipped - 18 lines]
> DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
> 'Faith without judgement merely degrades the spirit divine.'
I am no expert.
Asad