Bitshifting a long in Java
问题 Im sure this is an easy one for whoever sees it first! Why in Java does code like long one = 1 << 0; long thirty = 1 << 30; long thirtyOne = 1 << 31; long thirtyTwo = 1 << 32; System.out.println(one+" = "+Long.toBinaryString(1 << 0)); System.out.println(thirty+" = "+Long.toBinaryString(1 << 30)); System.out.println(thirtyOne+" = "+Long.toBinaryString(1 << 31)); System.out.println(thirtyTwo+" = "+Long.toBinaryString(1 << 32)); print 1 = 1 1073741824 = 1000000000000000000000000000000