Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

Converting Integer to any base

Thread view: 
Dexter - 20 Mar 2008 09:11 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). 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.