public static float absoluteDifference(float a, float b) {
    if (Float.compare(a, b) == 0) {  // Shortcut: handles infinities and NaNs.
      return 0;
    } else {
      return Math.abs(a - b);
    }
  }
public static float absoluteDifference(float a, float b) {
    if (Float.compare(a, b) == 0) {  
      return 0;
    } else {
      return Math.abs(a - b);
    }
  }
public static float absoluteDifference ( float a , float b ) { if ( Float . compare ( a , b ) == 0 ) { // Shortcut: handles infinities and NaNs. return 0 ; } else { return Math . abs ( a - b ) ; } }
Returns the absolute difference between two numbers, i.e. {@code |a - b|}.

@param a  first number.
@param b  second number.
@return   the absolute difference.
Returns the absolute difference between two numbers i . e . { @code |a - b| } .