Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   I am performing left shift by 1 operation in java (https://www.askmehelpdesk.com/showthread.php?t=830085)

  • Jan 22, 2017, 10:01 PM
    antariksh12
    I am performing left shift by 1 operation in java
    byte b=65;
    System.out.println(b<<1);
    O/p is 130.How?
  • Jan 23, 2017, 08:46 AM
    CravenMorhead
    Write both numbers in binary, if the answer isn't obvious then write down 65 in binary. Add a zero on the right hand side, (The net effect of shifting to the left). Convert resultant number back to decimal. What do you get?

  • All times are GMT -7. The time now is 10:11 PM.