File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes decimal value for Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "decimal value for "ffff" is 69904" Watch "decimal value for "ffff" is 69904" New topic

decimal value for "ffff" is 69904

Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
Hi there,
Please look at the code.
If I uncomment at variable "d", I do get compilation error.
Can you tell me why ?
My understanding is, decimal value for "ffff" is 69904.
Therefor I don't see any difference between variable c and d.
Please forgive my ignorance.

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

0xFFFF is 65535, not 69904. 69904 is thus somewhat larger than the largest possible char value -- hence the compile error.

[Jess in Action][AskingGoodQuestions]
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
0xffff == 65535 == Character.MAX_VALUE
Decimal value of a hex number can be found by adding the product of each hex digit multiplied by 16^(position), as such:

subject: decimal value for "ffff" is 69904