• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Binar representation of octal & hexadecimal nos

 
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to convert hexadecimal & octal numbers to binary?Should I convert them first to decimal & then to binary?Can someone explain with example?
Thanks
Veena
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Veena,
You certainly should not convert to decimal before converting to binary. The only reason for the popularity of octal and hex is the fact that both are very easy to convert to binary.
Each hex character represents four bits. To convert hex to binary, just write down the four bits that represent each hex character.
0x1234 = 0001 0010 0011 0100
What could be easier than that?
Three octal characters are needed to represent a single 8-bit byte. The two characters on the right each represent three bits so both of the rightmost characters represent the six least significant bits of the byte. The third character from the right represents the two most significant bits. Java uses a leading zero as a prefix that indicates that the number is octal.
0123 = 01 010 011
0311 = 11 001 001
011 = 00 001 001
01 = 00 000 001
Octal was very popular when most computers were eight bit machines. Hexadecimal is a better representation when the data values are composed of more than one byte.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may help (Acrobat PDF!)
-Barry
[ August 09, 2002: Message edited by: Barry Gaunt ]
 
Veena Pointi
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a lot easier than converting decimal numbers to binary!.Thanks Dan.
Veena
reply
    Bookmark Topic Watch Topic
  • New Topic