Range of float in java. Calculate max and min value of float in java.

Range of float in java. Calculate max and min value of float in java.


Posted in : Core Java Posted on : October 4, 2010 at 4:05 PM Comments : [ 0 ]

In this tutorial, you will see how to calculate the range of float in java.

Range of float in java. Calculate max and min value of float in java.

In this example, you will see how to calculate range of float in java. First of all, we will create a object of  Float . The Float is a wrapper class of  long in java.  And the MAX_VALUE and MIN_VALUE properties of Float class returns maximum and minimum value of float.

Code:

RangeOfFloat.java
package com.devmanuals;
public class RangeOfFloat {

public static void main(String[] args) {
	Float fNum = 12.05f;
	System.out.println("Maximum Value of float : " + fNum.MAX_VALUE);
	System.out.println("Minimum value of float" + fNum.MIN_VALUE);
	}
}
Output:
Maximum Value of float : 3.4028235E38
Minimum value of float1.4E-45

Download this code.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics