---
title: "JAVA中移位预算与与运算"
author: "liuInsect"
date: "2012-12-10T13:50:08Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2012-12-10T13:50:07Z"
id: 1696564
url: "https://liuinsect.iteye.com/blog/1696564"
---

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


	
	}

}
```