R4R Java SourceCode Byte Shift Operator

Byte Shift Operator

This is example of byte shift left ,byte shift right and byte shift unsigned operator.

SOURCE CODE


class byteshift
{
public static void main(String args[])
{
byte a=64,b;
int i;
i=a<<3;
b=(byte)(a<<3);
System.out.println("original value of a:"+a);
System.out.println("i and b:"+i+""+b);
b=(byte)(a>>3);
System.out.println("original value of a:"+a);
System.out.println("i and b:(>>)"+i+""+b);
b=(byte)(a>>>3);
System.out.println("original value of a:"+a);
System.out.println("i and b(>>>):"+i+""+b);
}
}

Download Source File