Original Post
I am having trouble with a program I am suppose to make. The simple issue is, all ways I would do it I am not allowed to. I am suppose to take a hex number and transfer it into the exponent times the sum of powers of 2. I cannot figure out how to get this into a usable integer. I have done this int hex = Integer.parseInt("3e900000", 16); String b = Integer.toBinaryString(hex); but that just brings it t a string and as far as I know I cannot do anything with a string. Does any one have any suggestions? Here is the exact assignment so u will see what things I cannot do which I would do.
Quote:Any help would be a welcome addition to this confused man.
Write a program that takes a hexadecimal number which it interprets to be a IEEE single precision floating point value and prints it out as 2 to the exponent times the sum of powers of 2. The input value should be a command line parameter. Use of the program should look like this: F:\371\lab1> java Fexpand 3e900000 3e900000 ==> 2^-2(1 + 2^-3) Use only integer (bitwise and shift) operations. Do not use floating point variables in any of the intermediate steps. Do not use Strings where you can avoid it. Avoid arrays. Avoid Math.pow(...). For this lab, no writeup is required. Hand this lab in by emailing your code to me (so I can run it).