package gotowe.p04_operatory;

public class Bitowe1 {

    public static void main(String[] args) {
        byte x = 25;
        byte y = -25;
        byte shift = 2;

        System.out.printf("x = %d  y = %d %n", x, y);
        System.out.println("Bez przycinania (w zakresie int):");
        System.out.printf("x << %d = %d %n", shift, x << shift);
        System.out.printf("y << %d = %d %n", shift, y << shift);
        System.out.printf("x >> %d = %d %n", shift, x >> shift);
        System.out.printf("y >> %d = %d %n", shift, y >> shift);
        System.out.printf("x >>> %d = %d %n", shift, x >>> shift);
        System.out.printf("y >>> %d = %d %n", shift, y >>> shift);
        System.out.println();
        System.out.println("Przycięte do byte: ");
        System.out.printf("x << %d = %d %n", shift, (byte)(x << shift));
        System.out.printf("y << %d = %d %n", shift, (byte)(y << shift));
        System.out.printf("x >> %d = %d %n", shift, (byte)(x >> shift));
        System.out.printf("y >> %d = %d %n", shift, (byte)(y >> shift));
        System.out.printf("x >>> %d = %d %n", shift, (byte)(x >>> shift));
        System.out.printf("y >>> %d = %d %n", shift, (byte)(y >>> shift));

    }

}
