shift06_03.java
                                            
                                                
                                                
                                                
                                                
                                                
                                                 7336 단어  javaprogrammingbeginnerstutorial
                    
// Shift Operators
    // problem:
    // Shift06_03.java{wirte java program showing the working of Shift Operators.}
class Shift06_03
{
    public static void main(String args[])
    {
        int x= 2 , y= 1;
        System.out.println("Value of x and y is = "+x+" "+y);
        System.out.println("Binary value of x and y is "+Integer.toBinaryString(x)+" "+Integer.toBinaryString(y));
        System.out.println("Binary notation of x and y is: 000000010 00000001");
        System.out.println("Left Shift Operator "+x+" << "+y+" => "+(x<<y));
        System.out.println("Left shift work by shifting 'y' bit in left side in binary notation of 'x' as follows: 00000010 << 000000100");
        System.out.println("Right Shift Operator "+x+" >> "+y+" => "+(x>>y));
        System.out.println("Right shift work by shifting 'y' bit in right side in binary notation of 'x' as follows: 00000010 >> 00000001");
        System.out.println("Unsigned Right Shift Operator "+x+">>>"+y+"=>"+((x>>>y)));
        System.out.println("Unsigned Right Shift Operator work by shifting the 'y' bits in right side in binary notation but signed is not copied. ");
        System.out.println("Showing the Unsigned operator with negative sign on x");
        System.out.println("Left Shift Operator -"+x+" << "+y+" => "+(-x<<y));
        System.out.println("Right Shift Operator -"+x+" >> "+y+" => "+(-x>>y));
        System.out.println("Unsigned Right Shift Operator -"+x+">>>"+y+" => "+((-x>>>y)));
        System.out.println("ENDING THE PROGRAM...\n:-) THANK YOU (-:");
    }
}
Reference
이 문제에 관하여(shift06_03.java), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/ukantjadia/shift0603java-27df텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)