MAX/MIN_VALUE Find out the Maximum value and Minimum value a float type can have
static float MAX_VALUE
- Largest positive finite value of type float.
static float MIN_VALUE
- Smallest positive nonzero value of type float.
static int MAX_EXPONENT
- Maximum exponent a finite float variable may have.
static int MIN_EXPONENT
- Minimum exponent a normalized float variable may have.
static float MIN_NORMAL
- Smallest positive normal value of type float.
public class Main {
public static void main(String[] args) {
System.out.println("MAX_VALUE:"+Float.MAX_VALUE);
System.out.println("MIN_VALUE:"+Float.MIN_VALUE);
System.out.println("MAX_EXPONENT:"+Float.MAX_EXPONENT);
System.out.println("MIN_EXPONENT:"+Float.MIN_EXPONENT);
System.out.println("MIN_NORMAL:"+Float.MIN_NORMAL);
}
}
The output:
MAX_VALUE:3.4028235E38
MIN_VALUE:1.4E-45
MAX_EXPONENT:127
MIN_EXPONENT:-126
MIN_NORMAL:1.17549435E-38
static float NaN
- Not-a-Number (NaN) value of type float.
static float NEGATIVE_INFINITY
- Negative infinity of type float.
static float POSITIVE_INFINITY
- Positive infinity of type float.
static int SIZE
- The number of bits used to represent a float value.
static Class TYPE
- The Class instance representing the primitive type float.
public class Main {
public static void main(String[] args) {
System.out.println("NaN:"+Float.NaN);
System.out.println("NEGATIVE_INFINITY:"+Float.NEGATIVE_INFINITY);
System.out.println("POSITIVE_INFINITY:"+Float.POSITIVE_INFINITY);
System.out.println("SIZE:"+Float.SIZE);
}
}
The output:
NaN:NaN
NEGATIVE_INFINITY:-Infinity
POSITIVE_INFINITY:Infinity
SIZE:32
Home
Java Book
Essential Classes
Java Book
Essential Classes
Float:
- Float class
- MAX/MIN_VALUE Find out the Maximum value and Minimum value a float type can have
- Create a Float object
- Convert Float to byte, double, float, int, long and short
- Compare two float objects
- Infinite and Not A Number
- Convert float value to Hex String value
- Convert float value to String value
- Convert string value to float value
- Bit oriented calculation for float