• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

conversion

 
Sam Cooper
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understood how to convert one system of representation to other. Here is an example of converting hexa to decimal.
0x7D
13*16^0 + 7*16^1
13*1 + 7*16
125
But what is the x in 0x7D?,
DOES THAT HAVE ANY SIGNIFICANCE?
Thanks
Sam
 
Rajinder Yadav
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sure does, it's a way of telling java that a number begining with 0x or 0X is a hexadecimal!
0x22 != 22
same goes for octal, they start of with a leading zero
(octal) 055 != 55 (interger)
 
Sam Cooper
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rajinder:
O or OX declare that it is octal or hexa decimal number but they do not contribute to the value while converting them to the decimal.
Am I right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic