Wednesday, 4 November 2015

Java Tutorial : Java bitwise Unsigned Right Shift Operator


Click here to watch in Youtube :
https://www.youtube.com/watch?v=V6RBuahi1yU&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java bitwise Unsigned Right Shift Operator
Java Tutorial : Java bitwise Unsigned Right Shift Operator
BitwiseUnsignedRightShiftOperatorDemo.java
class BitwiseUnsignedRightShiftOperatorDemo
{
    public static void main(String[] args)
    {
        
        int a = 240; // 11110000
        
        System.out.println("binary of 'a'            :"
                + Integer.toBinaryString(a) + "\n");


        /*
         * Number of bits needs to be moved to Right.
         */
        int b = 2; 

        /*
         * The left operand value is moved right by the number of bits specified
         * by the right operand and shifted values are filled up with zeros.
         */     
        int value = a >>> b; // 00111100
        
        System.out.println("binary of 'value' after\n unsigned right shift  :    "
                + Integer.toBinaryString(value));

        System.out.println("Value : " + value);

    }
}
Output
binary of 'a'            :11110000

binary of 'value' after
 unsigned right shift  :    111100
Value : 60
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/OperatorsDemoUnsignedRightShiftOperatorApp.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OperatorsDemoUnsignedRightShiftOperatorApp

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/9c29c9c8cf10305cf0952ccfd17cdec26383c2e4/BasicJava/OperatorsDemoUnsignedRightShiftOperatorApp/?at=master

Refer:
http://www.binaryhexconverter.com/binary-to-decimal-converter

See also:

  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge