Java Reference
In-Depth Information
world'swrittenlanguages. Unicode 0 isshorthandfor“thefirstUnicodecodepoint”—a
code point is an integer that represents a symbol (e.g., A) or a control character (e.g.,
newline or tab), or that combines with other code points to form a symbol. Check out
Wikipedia's“Unicode”entry( http://en.wikipedia.org/wiki/Unicode )to
learn more about this standard, and Wikipedia's“Universal Character Set” entry ( ht-
tp://en.wikipedia.org/wiki/Universal_Character_Set ) to learn
more about this standard.
Note Thecharactertype'slimitsimplythatthistypeisunsigned(allcharactervalues
arepositive).Incontrast,eachnumerictypeissigned(itsupportspositiveandnegative
values).
The minimum and maximum values of the byte integer, short integer, integer, and
longintegertypesrevealthatthereisonemorenegativevaluethanpositivevalue(0is
typicallynotregardedasapositivevalue).Thereasonforthisimbalancehastodowith
how integers are represented.
Javarepresentsanintegervalueasacombinationofa sign bit (theleftmostbit—0for
apositivevalueand1foranegativevalue)and magnitude bits (allremainingbitstothe
rightofthesignbit).Ifthesignbitis0,themagnitudeisstoreddirectly.However,ifthe
signbitis1,themagnitudeisstoredusing twos-complement representationinwhichall
1sareflippedto0s,all0sareflippedto1s,and1isaddedtotheresult.Twos-comple-
ment is used so that negative integers can naturally coexist with positive integers. For
example, adding the representation of -1 to +1 yields 0. Figure 1-5 illustrates byte in-
teger 2's direct representation and byte integer -2's twos-complement representation.
Figure 1-5. The binary representation of two byte integer values begins with a sign bit.
The minimum and maximum values of the floating-point and double precision
floating-point types refer to IEEE 754 , which is a standard for representing floating-
point values in memory. Check out Wikipedia's “IEEE 754-2008” entry ( ht-
tp://en.wikipedia.org/wiki/IEEE_754 ) to learn more about this standard.
Search WWH ::




Custom Search