• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Hex Fix

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having a problem with conversion from hex and oct to decimal and vice versa. I am conversant with the values normally shown i.e 0xffff etc.
But I wanted to know is there a shortcut to convert hex values like 0xf2f0. And more importantly, will such values be asked in the exam for bitshifting examples?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at the static conversion methods in Integer, Long and other wrapper classes.
parseInt( String s, int radix ) will do base 8 and 16 from String to int.
toHexString( int n )
toOctalString( int n )
toBinaryString( int n )
are handy too. You might see constants in hex format but I don't think they ever use octal in a question.
Bill
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Check out this URL
http://www.rz.uni-hohenheim.de/rz/sys/basics/csc102/ch3.html
Surya
 
Trailboss
Posts: 23458
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PROPER NAMES ARE NOW REQUIRED!
Please see http://www.javaranch.com/ubb/Forum10/HTML/000180.html for details.
 
Ajay Nair
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot, Surya. I got it now. That link really helped!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic