ITeye博客

JAVA中移位预算与与运算

liuInsect · 2012-12-10 13:50 · 编程语言 · Markdown

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);


	
	}

}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。