• Post Reply Bookmark Topic Watch Topic
  • New Topic

Computation of left shift operator expression  RSS feed

 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide me simple way to calculate the n<<s operator expression.
 
shiva rao
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
n<<s

You can do like this n * pow(2,s).
for example
2<<4
2*pow(2,4) = 32
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our beginner's forum: Java In General (Beginner)...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!