This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "conversion" Watch "conversion" New topic
Author

conversion

Sam Cooper
Greenhorn

Joined: Feb 21, 2002
Posts: 14
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

Joined: Jan 18, 2002
Posts: 178
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)


<a href="http://www.rajindery.com" target="_blank" rel="nofollow">Rajinder Yadav</a><p>Each problem that I solved became a rule which served afterwards to solve other problems. --Rene Descartes
Sam Cooper
Greenhorn

Joined: Feb 21, 2002
Posts: 14
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: conversion
 
Similar Threads
cash's program please i need your help quickly!!!!!
100 times "hello world" without loop or recursive
Stupid Question
please help ???? how to convert hexadecimal ,octol to decimal values and back
how to convert decimals to octal and hexadecimal?