FileDocCategorySizeDatePackage
Math.javaAPI DocphoneME MR2 API (J2ME)4888Wed May 02 17:59:54 BST 2007java.lang

Math

public final class Math extends Object
The class Math contains methods for performing basic numeric operations.
version
1.48, 12/04/99 (CLDC 1.0, Spring 2000)
since
1.3

Fields Summary
Constructors Summary
private Math()
Don't let anyone instantiate this class.

Methods Summary
public static intabs(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.

param
a an int value.
return
the absolute value of the argument.
see
java.lang.Integer#MIN_VALUE

        return (a < 0) ? -a : a;
    
public static longabs(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.

param
a a long value.
return
the absolute value of the argument.
see
java.lang.Long#MIN_VALUE

        return (a < 0) ? -a : a;
    
public static intmax(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.

param
a an int value.
param
b an int value.
return
the larger of a and b.
see
java.lang.Long#MAX_VALUE

        return (a >= b) ? a : b;
    
public static longmax(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.

param
a a long value.
param
b a long value.
return
the larger of a and b.
see
java.lang.Long#MAX_VALUE

        return (a >= b) ? a : b;
    
public static intmin(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.

param
a an int value.
param
b an int value.
return
the smaller of a and b.
see
java.lang.Long#MIN_VALUE

        return (a <= b) ? a : b;
    
public static longmin(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.

param
a a long value.
param
b a long value.
return
the smaller of a and b.
see
java.lang.Long#MIN_VALUE

        return (a <= b) ? a : b;