Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Assuming signed 8-bit integers
- 01100101 // How 101 is represented in binary
- 00110010 // After right shifting one bit, this represents 50
- // Assuming signed 8-bit integers
- 01100101 // How 101 is represented in binary
- 11001010 // After left shifting one bit, this represents -54
- // Assuming unsigned 8-bit integers
- 01100101 // How 101 is represented in binary
- 11001010 // After left shifting one bit, this represents 202
- // Assuming signed 16-bit integers
- 00000000 01100101 // How 101 is represented in binary
- 00000000 11001010 // After left shifting one bit, this represents 202
- 00000001 10010100 // After left shifting one bit again, this represents 404
- 5287
- 5287 = (5 * 1000) + (2 * 100) + (8 * 10) + (7 * 1)
- 5287 = (5 * 10^3) + (2 * 10^2) + (8 * 10^1) + (7 * 10^0)
- 5287 = 00010100 10100111 (base 2)
- = (0 * 2^15) + (0 * 2^14) + (0 * 2^13) + (1 * 2^12)
- + (0 * 2^11) + (1 * 2^10) + (0 * 2^9) + (0 * 2^8)
- + (1 * 2^7) + (0 * 2^6) + (1 * 2^5) + (0 * 2^4)
- + (0 * 2^3) + (1 * 2^2) + (1 * 2^1) + (1 * 2^0)
- Base 10 : Base 2
- 1 : 0001
- 2 : 0010
- 3 : 0011
- 4 : 0100
- 5 : 0101
- 6 : 0110
- 7 : 0111
- 8 : 1000
- class X
- {
- public static void main(String args[])
- {
- System.out.println("20>>2 = "+20>>2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement