Numeric Values Representation in Java: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* https://www.ntu.edu.sg/home/ehchua/programming/java/datarepresentation.html
=Internal=
=Internal=


Line 4: Line 7:
* [[Java_Language#Primitive_Types|Java Language - Primitive Types]]
* [[Java_Language#Primitive_Types|Java Language - Primitive Types]]
* [[Two's Complement Representation]]
* [[Two's Complement Representation]]
=Overview=


=Primitive Types=
=Primitive Types=


==Integral Primitive Type==
==Integral Primitive Type==
 
{{Internal|Java_Language#Integral_Primitive_Types|Integral Primitive Types}}
An integral data type is a data type whose values are integers. There are five integral primitive types in Java: [[Java_Language#byte|byte]], [[Java_Language#short|short]], [[Java_Language#int|int]], [[Java_Language#long|long]] and [[Java_Language#char|char]]. Of those, the first four (<code>byte</code>, <code>short</code>, <code>int</code> and <code>long</code>) are signed, and <code>char</code> is unsigned.
 
<code>byte</code> is the smallest integral data type available in Java. Its values used one-byte (8 bites) and they are represented in two's complement.


==Floating Point Primitive Type==
==Floating Point Primitive Type==
 
{{Internal|Java_Language#Floating_Point_Primitive_Types|Floating Point Primitive Types}}
==Literals==
=BigInteger=
 
There are no <code>byte</code> literals, but any <code>int</code> literal that falls within the range of a byte can be assigned to a byte variable.
 
=TODO=
 
<font color=darkgray>
 
* Primitive Types
* Wrapper Types, auto-boxing.
* Number https://www.geeksforgeeks.org/java-lang-number-class-java/
* BigInt
* https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
* https://docs.oracle.com/javase/tutorial/java/data/numberclasses.html
* https://www.inf.unibz.it/~calvanese/teaching/06-07-ip/lecture-notes/uni04.pdf
* https://www.ntu.edu.sg/home/ehchua/programming/java/datarepresentation.html
</font>

Latest revision as of 21:35, 6 April 2020