how do I print in hexademical format?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: how do I print in hexademical format?

  1. #1
    Join Date
    Apr 2004
    Posts
    100

    how do I print in hexademical format?

    if I have a number, but want to print it in hexademical format instead of decimal, what code can I use? I dont think System.out.println takes any format strings. please help. thank you.

  2. #2
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174
    Hi,

    You just need to use the Integer class

    i.e.

    int x = 32;

    System.out.println(Integer.toHexString(x));

    Hope this helps.
    Cheers
    Graham.
    Hope this helps
    Graham

    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)

    http://www.grahamrobinsonsoftware.com

  3. #3
    Join Date
    Apr 2004
    Posts
    100
    thank you Graham! That is exactly what I need!!

  4. #4
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174
    no problem - happy to help
    Hope this helps
    Graham

    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)

    http://www.grahamrobinsonsoftware.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center