Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Converting  to another type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Converting  to another type" Watch "Converting  to another type" New topic

Converting to another type

vijaya dev
Ranch Hand

Joined: Jun 22, 2004
Posts: 33
Is there an easy way to convert a big binary number to an integer or long and viceversa. For example given a number
10000000 00000000 00000000 00000101 (-2147483643)
Is there an easy way to do this and Will the Java certification have number like this in any of the questions and require us to convert into another type.


SCJP 1.4
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
I am no expert on this. I did some study into this. I am told it was unnecessary and the exam is simpler.

Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
Conversions between binary and decimal are not a lot of fun, but conversions between binary, octal and hexadecimal are very easy.

The exam is not designed to be a math test, so you won't see any questions that give you a binary value and ask you to convert it to decimal. You might find some binary, octal or hexadecimal values on the exam; so it would be a good idea to make sure that you understand what those values represent. Understanding binary values is also helpful when you are working with the shift operators.

Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="" target="_blank" rel="nofollow">Try my mock exam.</a>
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
This seems to be coming up often, so I've added a post about this to my blog. You can read it here, if you'd like.

SCJP Tipline, etc.
I agree. Here's the link:
subject: Converting to another type
It's not a secret anymore!