aspose file tools*
The moose likes Beginning Java and the fly likes bit shifting example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "bit shifting example" Watch "bit shifting example" New topic
Author

bit shifting example

Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
I was looking at following example from link
http://www.jchq.net/certkey/0501certkey.htm




public class Shift2{
static int i=2;
public static void main(String argv[]){
System.out.println(32 % 32);
System.out.println( 3 >>> 32);
}
}
I clearly did not understood output.
I have not understood concepts behind >>>, >>,<<<,<<

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14276
    
  21

Have a look at the tutorials: Bitwise and Bit Shift Operators.

Note: The <<< operator does not exist. Only: >>, >>> and <<.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
And what output do you get? What did you expect?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: bit shifting example