当前位置:网站首页>Signed number and unsigned number

Signed number and unsigned number

2020-11-10 14:46:18 foot 365

1、 An unsigned number : Its highest position is 1 or 0, Like all the others , Used to indicate the size of the number .
A byte (1111 1111) 1111 1111=12^7+12^6+12^5+12^4+12^3+12^2+12^1+12^0=255; So the range of data represented by an unsigned byte is 0~255 common 256 individual ;

for example :100 No sign means :0110 0100

 

2、 Signed number : The highest number is called “ Sign bit ”. by 1 when , Indicates that the number is negative , by 0 The time is expressed as a positive value .
A byte (0111 1111) The highest 0 A positive sign ,0111 1111=+111 1111=+(12^6+12^5+12^4+12^3+12^2+12^1+1*2^0)=+127
A byte (1111 1111) The highest 1 A minus sign ,1111 1111 =-111 1111 =-127 So the range of data represented by a signed byte is -127 To +127 common 255 individual ;

for example :100 Signed representation :0110  0100  // highest 0 Express + Number , The last seven bits are the specific data bits

for example :-100 Signed representation : 1110  0100 // highest 1 Express - Number , The last seven bits are the specific data bits

 

Two 、java Basic data types in

JAVA The basic data type without sign is not provided in

 

版权声明
本文为[foot 365]所创,转载请带上原文链接,感谢