How to 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