JAVA中移位预算与与运算
来源:互联网 发布:特殊字符软件 编辑:程序博客网 时间:2024/05/09 07:40
import java.io.BufferedOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;public class IOTest { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { //移位操作符System.out.println( 18>>> 1);System.out.println( 18>>> 2);System.out.println( 18>>> 3); System.out.println( 18>>> 4); //同>>>移位操作符 System.out.println( 18>> 1);System.out.println( 18>> 2);System.out.println( 18>> 3); System.out.println( 18>> 4); /** * 0001 * 0110 * =0111 * =7 */ System.out.println( 1^6); /** * 0100 * 0010 * =0110 * =6 */ System.out.println( 4^2);}}