public class test{ public static void main(String[] args) { int m = 9; int n = m >> 3; int p = 8; int q=p <<2; System.out.println("m>>3 = "+ n); System.out.println("p<<3 = "+ q); }}
结果
m>>3 = 1p<<3 = 32
左移n位,原来的数乘以2^n;右移n位,原来的数除以2^n,取整数部分
本文共 376 字,大约阅读时间需要 1 分钟。
public class test{ public static void main(String[] args) { int m = 9; int n = m >> 3; int p = 8; int q=p <<2; System.out.println("m>>3 = "+ n); System.out.println("p<<3 = "+ q); }}
结果
m>>3 = 1p<<3 = 32
左移n位,原来的数乘以2^n;右移n位,原来的数除以2^n,取整数部分
转载于:https://www.cnblogs.com/thiaoqueen/p/8351105.html