您的位置:首页 > 编程语言 > Java开发

JAVA中移位预算与与运算

2013-02-25 19:46 302 查看
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);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: