Want this question answered?
Here's a simple Java method to perform the conversion from decimal to a binary string representation:public String toBinaryString(int n) {StringBuilder sb = new StringBuilder();while(n != 0) {sb.insert(0, n % 2 != 0 ? '1' : '0');n /= 2;}return sb.toString();}The java.lang.Integer class provides a conversion helper method between decimal (integer) and binary numbers in string form called toBinaryString().String binaryValue = Integer.toBinaryString(43) // 43-> "101011"
5.37510 is 101.0112 Normalize and you get 1.01011E210 (1.010112 * 22) IEEE 754 single precision format is 1 Sign Bit, 8 Exponent Bits in excess 127 format, and 23 mantissa bits with leading implied one missing, so... Sign bit is 0 (+) Exponent is 10000001 (127 + 2) Mantissa is 0101100 00000000 00000000 (101011... with leading 1 omitted) Splice this together and you get 01000000 10101100 00000000 00000000 But in Little Endian machines, like Intel IA 32, you reverse the bytes, so you get 00000000 00000000 10101100 010000000 All of this said, however, you should not care what the bit representation is in memory, because that makes you platform dependent, i.e. non-portable.
101011
101011
101011 in binary is 32+0+8+0+2+1=43
decimal value of 43
43
It is10101 011111 101011 101100 111111 101000 010111
8 = 10009 = 100110 = 101011 = 101112 = 110013 = 110114 = 111015 = 1111
32 + 8 + 2 + 1 = 1x25 + 0x24 + 1x23 + 0x22 + 1x21 + 1x20 = 101011 base 2
25 + 23 + 21 + 20 = 32 +8 +2+1 = 43
in base 2 think of everything (right to left) in order of 2s... 2^0, 2^1, 2^2, 2^3, etc. so if you have 101011, write those underneath (again, right to left). now multiply the two top to bottom and add all of them: so since you can get 2^5+2^3+2^1+2^0=32+8+2+1=43 good luck
101011 1 *32 = 32 0 *16 = 0 1 * 8 = 8 0 * 4 = 0 1 * 2 = 2 1 * 1 = 1 -------------- 32+8+2+1=43.
The binary numbers from 1 to 20 are...1 = 12 = 103 = 114 = 1005 = 1016 = 1107 = 1118 = 10009 = 100110 = 101011 = 101112 = 110013 = 110114 = 111015 = 111116 = 1000017 = 1000118 = 1001019 = 1001120 = 10100