Share via


Math.max

Class Overview | Class Members | This Package | All Packages

Syntax 1

public static int max( int a**, int** b )

Parameters
  • a
    an int value.
  • b
    an int value.
Returns

the larger of a and b.

Description

Returns the greater of two int values.

Syntax 2

public static long max( long a**, long** b )

Parameters
  • a
    a long value.
  • b
    a long value.
Returns

the larger of a and b.

Description

Returns the greater of two long values.

Syntax 3

public static float max( float a**, float** b )

Parameters
  • a
    a float value.
  • b
    a float value.
Returns

the larger of a and b.

Description

Returns the greater of two float values. If either value is NaN, then the result is NaN. Unlike the the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.

Syntax 4

public static double max( double a**, double** b )

Parameters
  • a
    a double value.
  • b
    a double value.
Returns

the larger of a and b.

Description

Returns the greater of two double values. If either value is NaN, then the result is NaN. Unlike the the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.