hts.StevenWood.com

[ Last Page ]

Math class methods on quiz

Method prototype

Description Example
double cos ( double x ) trigonometric sine of x (x is in radians: to convert degrees to radians use toRadians() )  cos ( 0.0 ) = 1.0
int max ( int  x, int y )
long max ( long x, long y)
larger value of x and y 
(also version for float values)
max ( 2.3, 12.8 ) = 12.8
max ( -2.4, -11.7) = -2.4
int min ( int  x, int y )
long min ( long x, long y )
smaller value of x and y
(also version for float values)
min ( 2.3, 12.8 ) = 2.3
min ( -2.4, -11.7 ) = -11.7
double pow ( double x, double y ) x raised to power y (xy pow ( 2.0, 5 ) = 32
pow ( 16, 0.5 ) = 4
long round( double x ) closest long to x   round ( 4.3 )  = 4
round ( -9.7 ) = -10
double sin ( double x) trigonometric sine of x (x is in radians: to convert degrees to radians use toRadians() )  sin ( 0.0 ) = 0.0
double sqrt ( double x ) square root of x sqrt ( 16.0 ) = 4
sqrt ( 2.0 ) = 1.14142...
double tan ( double x ) trigonometric cosine of x (x is in radians: to convert degrees to radians use toRadians() )  tan ( 0.0 ) = 0.0
double toRadians (double x) Converts an angle, x, measured in degrees to the equivalent angle measured in radians. toRadians ( 0. 0 ) = 0.0
toRadians ( 90.0 ) = 1.570..
toRadians ( 180.0 ) = 3.14..
PI not a method but a constant (or field as called in Java) 3.14159265358...
Note: to use any of these you need to use the format Math.PI, Math.sin(x), etc.

[Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+