|
MID Profile | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Math
The class Math
contains methods for performing basic
numeric operations.
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 |
public static int abs(int a)
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.
a
- an int
value.Integer.MIN_VALUE
public static long abs(long 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.
a
- a long
value.Long.MIN_VALUE
public static int max(int a, int b)
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.a
- an int
value.b
- an int
value.a
and b
.Long.MAX_VALUE
public static long max(long a, long b)
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.a
- a long
value.b
- a long
value.a
and b
.Long.MAX_VALUE
public static int min(int a, int b)
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.a
- an int
value.b
- an int
value.a
and b
.Long.MIN_VALUE
public static long min(long a, long b)
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.a
- a long
value.b
- a long
value.a
and b
.Long.MIN_VALUE
|
MID Profile | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |