当前位置:网站首页>Operator < <> > fool test case
Operator < <> > fool test case
2022-07-04 06:19:00 【A master of East and West】
Always remember : On the left is the operand , On the right yes Move digits ( This is the same for shift left and shift right )
public class Test {
// Start from the limit , Fool test
public static void main(String[] args) {
/*** Move left test ***/
// Operands Shift left arrow Shift left digit Binary system Decimal system
System.out.println(1 << 0); // 1 Moving to the left 0 position , 1 = 1
System.out.println(1 << 1); // 1 Moving to the left 1 position , 10 = 2
System.out.println(1 << 2); // 1 Moving to the left 2 position , 100 = 4
System.out.println(1 << 3); // 1 Moving to the left 3 position , 1000 = 8
System.out.println(1 << 4); // 1 Moving to the left 4 position ,10000 = 16
System.out.println(2 << 1); // 2 Moving to the left 1 position ,10 change 100 namely 4
System.out.println(2 << 2); // 2 Moving to the left 2 position ,10 change 1000 namely 8
System.out.println(2 << 3); // 2 Moving to the left 3 position ,10 change 10000 namely 16
System.out.println(2 << 4); // 2 Moving to the left 4 position ,10 change 100000 namely 32
System.out.println(3 << 1); // 3 Moving to the left 1 position ,11 change 110 namely 6
System.out.println(3 << 2); // 3 Moving to the left 2 position ,11 change 1100 namely 12
System.out.println(3 << 3); // 3 Moving to the left 3 position ,11 change 11000 namely 24
System.out.println(3 << 4); // 3 Moving to the left 4 position ,11 change 110000 namely 48
/*** Move right test ***/
// Operands Shift right arrow Shift the number of digits to the right Binary system Decimal system
System.out.println(1 >> 0); // 1 Move right 0 position , 1 = 1
System.out.println(1 >> 1); // 1 Move right 1 position , 0 = 0
System.out.println(1 >> 2); // 1 Move right 2 position , 0 = 0
System.out.println(1 >> 3); // 1 Move right 3 position , 0 = 0
System.out.println(1 >> 4); // 1 Move right 4 position , 0 = 0
System.out.println(2 >> 0); // 2 Move right 1 position ,10 change 10 namely 2
System.out.println(2 >> 1); // 2 Move right 1 position ,10 change 01 namely 1
System.out.println(2 >> 2); // 2 Move right 2 position ,10 change 00 namely 0
System.out.println(2 >> 3); // 2 Move right 3 position ,10 change 00 namely 0
System.out.println(2 >> 4); // 2 Move right 4 position ,10 change 00 namely 0
System.out.println(3 >> 1); // 3 Move right 1 position ,11 change 01 namely 1
System.out.println(3 >> 2); // 3 Move right 2 position ,11 change 00 namely 0
System.out.println(3 >> 3); // 3 Move right 3 position ,11 change 00 namely 0
System.out.println(3 >> 4); // 3 Move right 4 position ,11 change 00 namely 0
}
}
边栏推荐
- QT 获取随机颜色值设置label背景色 代码
- STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
- Webrtc quickly set up video call and video conference
- lightroom 导入图片灰色/黑色矩形 多显示器
- JSON web token -- comparison between JWT and traditional session login authentication
- [microservice] Nacos cluster building and loading file configuration
- ES6 modularization
- HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
- Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
- Average two numbers
猜你喜欢
体验碎周报第 102 期(2022.7.4)
How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
A little understanding of GSLB (global server load balance) technology
JSON web token -- comparison between JWT and traditional session login authentication
Bicolor case
My NVIDIA developer journey - optimizing graphics card performance
雲原生——上雲必讀之SSH篇(常用於遠程登錄雲服務器)
win10清除快速访问-不留下痕迹
C réaliser des jeux de serpents gourmands
[untitled]
随机推荐
Error CVC complex type 2.4. a: Invalid content beginning with element 'base extension' was found. Should start with one of '{layoutlib}'.
MySQL information_ Schema database
HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
My NVIDIA developer journey - optimizing graphics card performance
Install pytoch geometric
Sort list tool class, which can sort strings
Compound nonlinear feedback control (2)
复合非线性反馈控制(二)
How to help others effectively
C实现贪吃蛇小游戏
Leakage detection relay jy82-2p
剑指 Offer II 038. 每日温度
Inputstream/outputstream (input and output of file)
198. House raiding
雲原生——上雲必讀之SSH篇(常用於遠程登錄雲服務器)
2022.7.2-----leetcode.871
740. Delete and get points
Nexus 6p从8.0降级6.0+root
Reading notes of Clickhouse principle analysis and Application Practice (4)
Practical gadget instructions