Save
AP Comp Sci A
Math Methods
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Daniel Moore
Visit profile
Cards (9)
Math.min(x,y)
returns the
smallest
of x and y. Accepts
int
or
double
values
Math.max(x,y)
returns the
largest
of x and y. Accepts
int
or
double
values.
Math.sqrt(x)
returns the square
root
of
x.
Accepts
int
or
double
values.
Math.abs(x)
returns the
absolute value
of
x
(the
distance
from
zero
). Accepts
int
or
double
values.
Math.pow(base, exponent) raises base
to the
power
of
exponent.
Accepts
int
or
double
values.
Math.random()
generates a
random number
between
0.0
and
1.0.
The
result
is always
less
than
one.
Math.floor(double x) rounds
x
downward
to the next
lower
integer.
Math.ceil(double x) rounds
x
upward
to the next
higher
integer.
Math.round(double x) rounds
x to the
nearest
integer.
>=
5
round
up
<
5
round
down