/* Program to demonstrate Bitwise Shift Operators */
class BitShift
{
public static void main(String args[])
{
int A = 6, B=-6;
System.out.println("A : "+A);
System.out.println("B : "+B);
System.out.println("A >> 2 : "+(A>>2));
System.out.println("A << 1 : "+(A<<1));
System.out.println("A >>> 1 : "+(A>>>1));
System.out.println("B >> 1 : "+(B>>1));
System.out.println("B >>> 1 : "+(B>>>1));
}
}
class BitShift
{
public static void main(String args[])
{
int A = 6, B=-6;
System.out.println("A : "+A);
System.out.println("B : "+B);
System.out.println("A >> 2 : "+(A>>2));
System.out.println("A << 1 : "+(A<<1));
System.out.println("A >>> 1 : "+(A>>>1));
System.out.println("B >> 1 : "+(B>>1));
System.out.println("B >>> 1 : "+(B>>>1));
}
}
0 comments:
Post a Comment