Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding Bit Shifting

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can anybody please provide me some URL's related to bit shifting operation?
I mean containing examples related to bit shifting etc.

Thanks
Sneha
 
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shena,

check the following GREAT links:
http://www.javaranch.com/journal/200406/ScjpTipLine-BitShifting.html
http://www.javaranch.com/campfire/StoryBits.jsp

Plus read the following as well:

Shift and Bitwise operators are used to manipulate data at bit level.

Shift operatorsBitwise operators
>>&
<<^
>>>|
~

Shift operators should be used only with operands of type int or long, though they can also be used with other integral types. Shift operators always return a result of type INT or LONG.

Positive integer0..0 110012
Negative integer1..1 1100-4

Negative integer1..1 1100-4
Signed right-shift1..1 1110-2
unsigned right-shift0..1 11102147483646
Left-shift1..1 1000-8

With the unsigned right-shift operator (>>> and the left shift operator, the new bits are always set to 0.

The result of ~x will always be the value ((-x) -1)




regards,
Gitesh
[ August 31, 2007: Message edited by: Gitesh Ramchandani ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic