• 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

conversion from hex to decimal

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please tell me how do u convert a hex number 0xFEB8 to decimal.
the actual answer is -328.but i dont know how it is done.

hi there chetan.but in the book "exam cram"
pg 43 its given:
DECIMAL HEX
343 0x157
275 0x0113
-328 0xFEB8
the first two i can understand but the last
one differs from your answer.please help.
[This message has been edited by kishen uchil (edited August 30, 2000).]
 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
remember the folln table:
DecimalBinaryOctalHexadecimal
00000000
10000111
20001022
30001133
40010044
50010155
60011066
70011177
801000108
901001119
100101012A
110101113B
120110014C
130110115D
140111016E
150111117F
16100002010
����
����
����
Conversion of hex to dec:
your example: 0xFEB8
F*(16^3)+ E*(16^2) + B*(16^1) + 8*(10^0)
lookup of hex values F,E,B in above table
yields 17,16 and 11 resp.
substituting,
17*(16^3)+ 16*(16^2) + 11*(16^1) + 8*(10^0)
answer:65208
HTH,
chetan
 
kishen uchil
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there chetan.but in the book "exam cram"
pg 43 its given:
DECIMAL HEX
343 0x157
275 0x0113
-328 0xFEB8
the first two i can understand but the last
one differs from your answer.please help.
 
chetan nain
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you may try it :
System.out.println(0xFEB8);
gives 65208
am i missing something here?
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
-328 when converted to hex in windows calculator gives FFFFFEB8.
So it might be due to the negative sign. please check it out. It may be 2's complement, 1's complement or something similar to that, I am not sure.
 
kishen uchil
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there chetan.im sorry man u were right.actually -328 equates
to 0xfffffeb8 in hex .the book was wrong.thanks very much for the help.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic