Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shifting Operators?

Status
Not open for further replies.

ietprofessional

Programmer
Apr 1, 2004
267
US
I'm trying to get Java certified and I'd like someone to explain to me why a programmer would use shifting operators?

<<, >>, >>>

I'm learning how they work but don't know why I would use them in the real world, unless it was for encrypting a number or something.

Thanks,

Harold
 
// for programming in game and a large task(scientific research), fast calculation is very important.
left shift << can give you the result of being multiplied by(2^n).
3<<1 give you a result of 6.
4>>1 give you a result of 2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top