对于一个由w位组成的数据类型,如果要移动k>=w位会得到什么结果?
public class Main {
public static void main(String[] args) {
int a1 = 0x12345678;
a1=a1<<32;
System.out.println("0x12345678<<32 = 0x"+ Integer.toHexString(a1));
int a2 = 0x12345678;
a2=a2<<36;
System.out.println("0x12345678<<36 = 0x"+Integer.toHexString(a2));
int a3 = 0x12345678;
a3=a3<<40;
System.out.println("0x12345678<<40 = 0x"+Integer.toHexString(a3));
}
}
结果为
移位量通过k mod w得到