Solved

Number to HEX Conversion

Posted on 2001-07-05
15
444 Views
Last Modified: 2010-04-16
Make a program that ask to Input a number and have it print out a hex and bin number

Good Luck...

Ajay Chadha .. :-)
0
Comment
Question by:AJAY CHADHA
  • 5
  • 5
  • 2
  • +2
15 Comments
 
LVL 8

Author Comment

by:AJAY CHADHA
ID: 6257903
Please let me know if it requires more points.
0
 
LVL 92

Expert Comment

by:objects
ID: 6257971
Sorry, doing peoples homework is not permitted on ee.
0
 
LVL 8

Author Comment

by:AJAY CHADHA
ID: 6257998
This is not a homework. Actually I'm an experienced Coder with expertise in VB. I'm learning Java and this is the problem I had.

Please send the working sourece code
0
 
LVL 92

Expert Comment

by:objects
ID: 6258032
Then ask specific questions about solving your problem.
'Please supply working code' is not a question.

Have a look at the method Integer.toHexString().
0
 
LVL 8

Author Comment

by:AJAY CHADHA
ID: 6258538
Thanks objects ,

Could you please come out with a sample code as I don't know anything of Java.

I'll definitely increase ponits for a working solution. I'm learning Java.

Ajay Chadha .. :-)
0
 
LVL 8

Author Comment

by:AJAY CHADHA
ID: 6258540
I need detailed description of Integer.toHexString() with a sample code.

Ajay Chadha ... :-)
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 6258816
There is a detailed decription on Integer.toHexString anmfd Integer.to BinaryString in the Java API Documentation. This is available to browse here :

    http://java.sun.com/j2se/1.3/docs/api/index.html

Look up the class String in the class list and then look at the Static methods toHexString and toBinaryString. If you are serious about learning Java you had better get used to reading this stuff. It is absolutely indispensable.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Author Comment

by:AJAY CHADHA
ID: 6259296
Hello ozymandias,

I'm unable to find them out.

Please email them to me at ajay@chadhaajay.net
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 13 total points
ID: 6259411
1. It is always worth checking the PAQ on EE before you ask a question. This question has been asked and answered recently. Look at my answer to this question. It is an application that does exactly what you have asked for. (http://www.experts-exchange.com/jsp/qShow.jsp?qid=20145130).

2. What problem are you having reading the API documentation ?
0
 
LVL 4

Expert Comment

by:kylar
ID: 6260119
Let me put it to you this way: if you are unable to understand the API documentations (which I think most experts will agree with me is the MOST valuable and used resource) Then you need to start at the beginning. Go out and buy a book about programming in Java. I would recommend Thinking In Java, 2nd Ed by bruce eckel, which is available online (www.bruceeckel.com) and start reading. When you understand enough to make sense of the documentation of the APIs, then come back to us with specific problems and difficulties.

Cheers,
Kylar
0
 

Expert Comment

by:scooter1
ID: 6261269
For 13 points nobody wants to write a proggie for ya !!!

//Converter//

public class Converter {
     
     
      public static void main(String s[]) {
           
           
           int myInt = 25; //number to convert
           
           String HexInt = Integer.toHexString(myInt);       //convert to hex
           String BinInt = Integer.toBinaryString(myInt);       //convert to binary
           
           System.out.println(HexInt); // should give  19     Hex
           System.out.println(BinInt); // should give  11001  binary
           
           
      }

     
}
0
 
LVL 92

Expert Comment

by:objects
ID: 6261285
I didn't here any complaining or even mentioning the number of points involved. I don't think that had anything to do with it.
0
 
LVL 92

Expert Comment

by:objects
ID: 6261290
And in fact code was already provided by ozymandias.
0
 

Expert Comment

by:scooter1
ID: 6261294
I wasn't dissing the experts, I was just complaining about the points and the matter the question was asked to chadhaajay. :o)
0
 
LVL 92

Expert Comment

by:objects
ID: 6261310
understood :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now