java.lang.Float.compare()


java.lang.Float.compare()

package com.codingdict;



import java.lang.*;



public class FloatDemo {



   public static void main(String[] args) {



      // compares the two specified float values

      float f1 = 22.30f;

      float f2 = 88.67f;

      int retval = Float.compare(f1, f2);



      if(retval > 0) {

         System.out.println("f1 is greater than f2");

      } else if(retval < 0) {

         System.out.println("f1 is less than f2");

      } else {

         System.out.println("f1 is equal to f2");

      }

   }

}