java移位运算
2017-04-22 16:07
246 查看
public class Main { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(60<<2); //60*4,是60移位 System.out.println(2<<4); //2*16,是2移位 System.out.println(60>>2); // 60/4 System.out.println(16>>4); // 16/16 int hash = 1; hash = hash<<2; System.out.println(hash); // 1*4 int a = 2; int b = 4; int c = a|b; System.out.println(c); } }
240 32 15 1 4 6