O'Reilly logo

Introduction to Programming in Java: An Interdisciplinary Approach by Robert Sedgewick, Kevin Wayne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APIs

public class Math

double

abs(double a)

absolute value of a

double

max(double a, double b)

maximum of a and b

double

min(double a, double b)

minimum of a and b

Note 1: abs(), max(), and min() are defined also for int, long, and float.

double

sin(double theta)

sine of theta

double

cos(double theta)

cosine of theta

double

tan(double theta)

tangent of theta

Note 2: Angles are expressed in radians. Use toDegrees() and toRadians() to convert. Note 3: Use asin(), acos(), and atan() for inverse functions.

double

exp(double a)

exponential (ea)

double

log(double a)

natural log (loge a, or ln a)

double

pow(double a, double b)

raise a to the bth power (ab)

long

round(double a)

round a to the nearest integer

double

random() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required