-
September 13th, 2014, 12:36 PM
#1
Help Convert Signed Decimal Number to Binary and Vice Versa
Greetings, I understand how to convert positive decimals to binary and vice versa, but I am not quite sure how to go about factoring in negative numbers with their binary equivalents. It must be 8 bits (therefore, the decimal outputs must range from -128 to 127). Please help!
PS: I am not allowed to use toBinaryString for reasons unstated.
-
September 15th, 2014, 06:40 PM
#2
Re: Help Convert Signed Decimal Number to Binary and Vice Versa
how to convert positive decimals to binary
You can use an assignment statement to copy a value in an int variable to a byte variable by casting it.
Or are you talking about converting a String of decimal digit (0-9) characters to a String of binary digit (0-1) characters?
Norm
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|