import java.util.*;
public class Example3_1{
public static void main(String args[]){
Scanner reader=new Scanner(System.in);
System.out.println("输入待移位的int型整数:");
int x=reader.nextInt();
System.out.println("输入移位量:");
int n=reader.nextInt();
System.out.println("左移位的结果:"+(x<<n));
System.out.println("右移位的结果:"+(x>>n));
}
}
转载于:https://www.cnblogs.com/guoying/archive/2013/03/30/2990074.html