MID Profile

java.lang
Class Math


java.lang.Object

  |

  +--java.lang.Math


public final class Math
extends Object

The class Math contains methods for performing basic numeric operations.

Since:
JDK1.3, CLDC 1.0

Method Summary
static int abs(int a)
          Returns the absolute value of an int value.
static long abs(long a)
          Returns the absolute value of a long value.
static int max(int a, int b)
          Returns the greater of two int values.
static long max(long a, long b)
          Returns the greater of two long values.
static int min(int a, int b)
          Returns the smaller of two int values.
static long min(long a, long b)
          Returns the smaller of two long values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

abs


public static int abs(int a)
Returns the absolute value of an int value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Note that if the argument is equal to the value of Integer.MIN_VALUE, the most negative representable int value, the result is that same value, which is negative.

Parameters:
a - an int value.
Returns:
the absolute value of the argument.
See Also:
Integer.MIN_VALUE

abs


public static long abs(long a)
Returns the absolute value of a long value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Note that if the argument is equal to the value of Long.MIN_VALUE, the most negative representable long value, the result is that same value, which is negative.

Parameters:
a - a long value.
Returns:
the absolute value of the argument.
See Also:
Long.MIN_VALUE

max


public static int max(int a,
                      int b)
Returns the greater of two int values. That is, the result is the argument closer to the value of Integer.MAX_VALUE. If the arguments have the same value, the result is that same value.
Parameters:
a - an int value.
b - an int value.
Returns:
the larger of a and b.
See Also:
Long.MAX_VALUE

max


public static long max(long a,
                       long b)
Returns the greater of two long values. That is, the result is the argument closer to the value of Long.MAX_VALUE. If the arguments have the same value, the result is that same value.
Parameters:
a - a long value.
b - a long value.
Returns:
the larger of a and b.
See Also:
Long.MAX_VALUE

min


public static int min(int a,
                      int b)
Returns the smaller of two int values. That is, the result the argument closer to the value of Integer.MIN_VALUE. If the arguments have the same value, the result is that same value.
Parameters:
a - an int value.
b - an int value.
Returns:
the smaller of a and b.
See Also:
Long.MIN_VALUE

min


public static long min(long a,
                       long b)
Returns the smaller of two long values. That is, the result is the argument closer to the value of Long.MIN_VALUE. If the arguments have the same value, the result is that same value.
Parameters:
a - a long value.
b - a long value.
Returns:
the smaller of a and b.
See Also:
Long.MIN_VALUE

MID Profile

Submit a comment or suggestion Version 2.0 of MID Profile Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.