开发者

Logical (AND, OR, XOR) over Long

开发者 https://www.devze.com 2023-03-23 12:18 出处:网络
I am extending a tool in Java 开发者_高级运维that somehow is capable of applying Logical (AND, OR and XOR) over three Long values.

I am extending a tool in Java 开发者_高级运维that somehow is capable of applying Logical (AND, OR and XOR) over three Long values.

How is that possible? If it is possible?


You can apply bit-wise operators on longs:

  • & is AND
  • | is OR
  • ^ is XOR


Maybe they wanted to implement IDL-like logical operators

Default Definitions of True and False

Data Type                    True                              False 
====================================================================================
Byte,integer, and long       Odd integers                      Zero or even integers 
Floating point and complex   Non-zero values                   Zero 
String                       Any string with non-zero length   Null string (" ") 
Heap variables               Non-null values                   Null values


What do you mean by not possible? 3 | 4 | 5 is a perfectly valid expression as 3 & 4 & 5.

0

精彩评论

暂无评论...
验证码 换一张
取 消