java.lang Code Samples
- How do I reverse a string?
- How do I split a string?
- How do I add leading zeros to a number?
- How do I get file separator symbol?
- How do I terminate a Java application?
- How do I get operating system temporary directory / folder?
- What is Autoboxing?
- How do I copy char array to string?
- How do I remove trailing white space from a string?
- How do I calculate process elapsed time?
- How do I convert string to char array?
- How do I get package name of a class?
- How do I get the username of operating system active user?
- How do I check if a character representing a number?
Page 1 of 7 |
Prev
|
Next
How do I get the minimum and maximum value of a primitive data types?
To get the minimum or maximum value of a primitive data types such as byte, short, int, long, float and double we can use the wrapper class provided for each of them, the wrapper classes are Byte, Short, Integer, Long, Float and Double which is located in java.lang package.
The result of the code above shows the minimum and maximum value for each data types.
Byte.MIN = -128 Byte.MAX = 127 Short.MIN = -32768 Short.MAX = 32767 Integer.MIN = -2147483648 Integer.MAX = 2147483647 Long.MIN = -9223372036854775808 Long.MAX = 9223372036854775807 Float.MIN = 1.4E-45 Float.MAX = 3.4028235E38 Double.MIN = 4.9E-324 Double.MAX = 1.7976931348623157E308