You are on page 1of 5

Minimum & Maximum number of Byte data type

you can show minimum and maximum number of byte, using byte as data type and two variable
for store the number and print the variable.
byte a, b;
a = input the number;
b = input the number;
System.out.println(a + " and " + b);
Byte data type have 1 bytes value, it means that byte data type have 8 bit.
-2(n-1) is the formula of the minimum value of a byte data type and 2(n-1) – 1 is the formula of the
maximum value of a byte data type.
and the calculation for minimum is -2(8-1) = -128 and for maximum is 2(8-1) – 1 = 127

From pictures above we know that the minimum and maximum number of byte data type are
from –128 to 127.
Minimum & Maximum number of Integer data type
you can show minimum and maximum number of double, using float as data type and two
variable for store the number and print the variable.
int a, b;
a = input the number;
b = input the number;
System.out.println(a + " and " + b);
Integer data type have 4 bytes value, it means that integer data type have 32 bit.
-2(n-1) is the formula of the minimum value of a integer data type and 2(n-1) – 1 is the formula of
the maximum value of a byte data type.
and the calculation for minimum is -2(32-1) = - 2147483648 and for maximum is 2(32-1) – 1 =
2147483647

From pictures above we know that the minimum and maximum number of byte data type are
from – 2147483648 to 2147483647
Minimum & Maximum number of Float data type
you can show minimum and maximum number of float, using float as data type and two variable
for store the number and print the variable.
float a, b;
a = input the number.0f;
b = input the number.0f;
System.out.println(a + " and " + b);
Java language used IEEE Standard Binary 32 for floating-point arithmetic, therefore we use
gonna use that standard to find the limits.
IEEE 754 floating-point binary 32 number has 1 bit for the sign, 8 bits for the exponent, and 23
bits for the significand/mantissa.
With the sign, exponent and significand.
0 11111110 111111111111111111111112
and the calculation is ± 2127 × (2 − 2−23) = ±3.4028234664 × 1038
And the largest number is 3.4028234664 × 1038 and the minimum is - 3.4028234664 × 1038
After we got the value, let’s check if it’s true or not.

And the answer is right, that was the minimum and maximum of float data type, because the
answer gonna be wrong if you try to changes it like change the 0 between 4 and 2.
Minimum & Maximum number of Double data type
you can show minimum and maximum number of double, using float as data type and two
variable for store the number and print the variable.
double a, b;
a = input the number.0;
b = input the number.0;
System.out.println(a + " and " + b);
Java language used IEEE Standard Binary 64 for floating-point arithmetic, therefore we use
gonna use that standard to find the limits.
IEEE 754 floating-point binary 64 number has 1 bit for the sign, 11 bits for the exponent, and 53
bits for the significand/mantissa.
With the sign, exponent and significand.
0 11111111110 11111111111111111111111111111111111111111111111111112
and the calculation is ±21023 × (1 + (1 − 2−52)) = ± 1.7976931348623157 × 10308
And the largest number is 1.7976931348623157 × 10308 and the minimum is
- 1.7976931348623157 × 10308
After we got the value, let’s check if it’s true or not.

And the answer is right, that was the minimum and maximum of float data type, because the
answer gonna be wrong if you try to changes it like change the 7 between 9 and 6.
Source :
- https://www.tutorialspoint.com/java/java_basic_datatypes.htm
- https://en.wikipedia.org/wiki/Single-precision_floating-point_format
- https://en.wikipedia.org/wiki/Double-precision_floating-point_format

You might also like