java中如何实现计算位运算表达式的值?
1个回答
展开全部
import javax.swing.*;
public class ShiftOperator
{
public static void main(String[] args)
{
System.out.println(Integer.toBinaryString(789));
System.out.println(Integer.toBinaryString(-789));
System.out.println(789>>3);
System.out.println(Integer.toBinaryString(789>>3));
System.out.println(-789>>3);
System.out.println(Integer.toBinaryString(-789>>3));
System.out.println(789<<3);
System.out.println(Integer.toBinaryString(789<<3));
System.out.println(-789<<3);
System.out.println(Integer.toBinaryString(-789<<3));
System.out.println(789>>>3);
System.out.println(Integer.toBinaryString(789>>>3));
System.out.println(-789>>>3);
System.out.println(Integer.toBinaryString(-789>>>3));
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询