Java Data Type Tutorial - Java StrictMath.signum(float f)








Syntax

StrictMath.signum(float f) has the following syntax.

public static float signum(float f)

Example

In the following code shows how to use StrictMath.signum(float f) method.

/*  w  ww . j  a v  a2 s .c  om*/
public class Main {

  public static void main(String[] args) {
  
    float f1 = 123.45f, f2 = 0.0f, f3 = -0.0f;

    System.out.println(StrictMath.signum(f1));

    System.out.println(StrictMath.signum(f2));
    
    System.out.println(StrictMath.signum(f3)); 
  }
}

The code above generates the following result.