当前位置:网站首页>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
}
}
边栏推荐
- js获取对象中嵌套的属性值
- STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
- 安装 Pytorch geometric
- A little understanding of GSLB (global server load balance) technology
- How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
- 509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
- C language exercises (recursion)
- C实现贪吃蛇小游戏
- "In simple language programming competition (basic)" part 1 Introduction to language Chapter 3 branch structure programming
- Invalid bound statement (not found): com. example. mapper. TblUserRecordMapper. login
猜你喜欢
随机推荐
Sort list tool class, which can sort strings
复合非线性反馈控制(二)
Steady! Huawei micro certification Huawei cloud computing service practice is stable!
27-31. Dependency transitivity, principle
Yiwen unlocks Huawei's new cloud skills - the whole process of aiot development [device access - ESP end-to-side data collection [mqtt]- real time data analysis] (step-by-step screenshot is more detai
冲击继电器JC-7/11/DC110V
如何获取el-tree中所有节点的父节点
体验碎周报第 102 期(2022.7.4)
Learning multi-level structural information for small organ segmentation
JS get the attribute values nested in the object
Distributed cap theory
C实现贪吃蛇小游戏
C语言练习题(递归)
JS execution mechanism
Leetcode question brushing record | 206_ Reverse linked list
如何展开Collapse 的所有折叠面板
Manually page the list (parameter list, current page, page size)
740. Delete and get points
Install pytoch geometric
px em rem的区别