Converting Integer to any base

L

Lasse Reichstein Nielsen

Dexter 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). ....
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
 
D

Dexter

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#toStri...., int)>

Example source here:
<URL:http://www.docjar.com/html/api/java/lang/Integer.java.html>

/L

I am no expert.

Asad
 

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