• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

question

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

7. Represent the number 6 as a hexadecimal
literal.
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Siddharth,

Welcome to the Ranch

Did you miss to post any previous part of your question? Because I see the numbering start from #7. If not the number 6 is represented as 6 in Hexa too.
 
Greenhorn
Posts: 11
Netbeans IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Integer.toHexString(6); //will do the work!!
 
Ranch Hand
Posts: 275
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please have a look at This list of guidelines to make your Questions easily answerable..
 
Ranch Hand
Posts: 201
1
Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

siddharth lakhotia wrote:
7. Represent the number 6 as a hexadecimal
literal.



Well there are a couple of ways I know of to represent the number 6, a decimal integer, as a hexadecimal value. The easy way would be to understand that from 0 to 9 both decimal and hexadecimal are the same, so decimal 6 is also 6 in hexadecimal, its only after 9 that hexadecimal represents 10 as A, 11 as B, 12 as C, 13 as D, 14 as E, and 15 as F.

The other way would be to repeatedly divide 6 by 16 until the remainder is 0. Then the remainders in reverse order is your new hexadecimal number. I attached a graphic that explains this. There are a few webpages that talk about it too, and a few webpages with programs that do the calculation for you! : )



decimal in to hexadecimal converter with rosetta type stone graphic showing how they relate: http://www.easycalculation.com/decimal-converter.php
please find this relatively simple guide to converting base-10 to base-16: http://www.wikihow.com/Convert-from-Decimal-to-Hexadecimal
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic