Java Reference
In-Depth Information
Table 4-14.
(
continued
)
Property/Method
Description
Math.acos(x),
Math.asin(x),
Math.atan(x)
Returns arc cosine, arc sine, and arc tangent of
x
Math.atan(y, x)
Returns the arc tangent of the quotient
y/x
of the arguments
y
and
x
, where the signs of
y
and
x
are used to determine the quadrant of
the result
Math.ceil(x)
Returns the closest integer that is greater than or equal to x
Math.cos(x),
Math.sin(x),
Math.tan(x)
Returns cosine, sine, and tangent of
x
Math.exp(x)
Returns
e
raised to the power of x, where
e
is
Math.E
Math.floor(x)
Returns the closest integer that is less than or equal to x
Math.log(x)
Returns the natural logarithm of x. That is, computes the logarithm
of x base-
e
Math.max(v1,
v2,...)
Returns the maximum of all arguments
v1
,
v2
, and so on,
converting the arguments to Number type if necessary. If no
arguments are passed,
-Infinity
is returned
Math.min(v1,
v2,...)
Returns the minimum of all arguments
v1
,
v2
, and so on,
converting the arguments to Number type if necessary. If no
arguments are passed,
Infinity
is returned
Math.pow(x, y)
Returns the result of raising
x
to the power
y
Math.random()
Returns a random number between 0 (inclusive) and 1 (exclusive)
Math.round(x)
Returns an integer closed to
x
. If two integers are equally close,
returns the integer that is closer to
+Infinity
. For example,
Math.round(2.3)
returns 2,
Math.round(2.9)
returns 3, and
Math.
round(2.5)
returns 3
Math.sqrt(x)
Returns the square root of x
The RegExp Object
A regular expression represents a pattern in input text. The
RegExp
object is a function.
It represents a regular expression and contains several methods and properties to match
the pattern in input text.
RegExp
can be used as a function or a constructor. Its signature is:
RegExp(pattern, flags)
Search WWH ::
Custom Search