• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hex, Octal, converstions to Int? Tricks anyone?

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My textbook just goes through literally 2 or 3 examples of each.
ie 010 = int 8.
and 0xf = int 15.
Does anyone have a trick to figure out the larger numbers? Maybe my brain is jello from studying too hard...cuz I can't seem to figure out a formula to convert larger Hex, and Octal numbers into an integer!
Thanks in advance! ! !
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To convert from any abitrary base to base 10, you simply take each digit and multiply it with the proper power of two and sum these values. Take these examples:

If you need more help with this, do a search in this forum - I'm sure you'll find lots more samples.
Corey
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic