I need to get a string from the console that is given in hex form like this: 3e900000.
Then I need to convert it into bit so I can do bit wise thigns too it to generate the following out put:
3e900000 ==> 2^-2(1 + 2^-3)
The above is a factored way of showing IEEE 754 for 32bit floating point decimal numbers.
I know that I can use String args[]
to get the console input. So I would be using args[0]
. No need for error checking on this one.
I can do the problem but I'm stuck on being able to easily get a real form of 32 bits of binary. Im not allowed to use floating point variables in any of the intermediate steps. I also need to avoid the use of Strings where I can, avoid arrays(for temp storage) and avoid Math.pow().
The point of the problem is not to deal with java or how to convert stirngs to what ever but the binary manipulation using bitwise functions and bit shifts. Like I said, I can do the bits part, Im just stuck on hex string to real full 32 bit binary no trimming leading 0 or stuff like that. it has to be in a form that can be bit masked.