Math.PI : Math « java.lang « Java by API


 * Output:
cos = 0.9999691576447897

public class MainClass {
  public static void main(String args[]) {
    double radians = 0.45 * Math.PI/180;
    System.out.println("cos = " + Math.cos(radians));


Related examples in the same category

2.Math: abs(int value)
3.Math.cbrt(double a) Returns the cube root of a double value.
4.Math: ceil(float value)
5.Math: copySign(double magnitude, double sign)
6.Math: cos(double doubleValue)
7.Math: exp(double a)
8.Math: floor(float value)
9.Math: getExponent(double d)
10.Math.hypot(double x, double y) Returns sqrt(x2 +y2) without intermediate overflow or underflow.
11.Math: log(double doubleValue)
12.Math.log10(double a)
13.Math: max(int value1, int value2)
14.Math: min(double a, double b)
15.Math: min(int value1, int value2)
16.Math: nextAfter(double start, double direction)
17.Math: nextUp(double d)
18.Math: pow(int a, int b)
19.Math: random()
20.Math.round(double a)
21.Math: scalb(double d, int scaleFactor)
22.Math.signum(float f)
23.Math: sin(double doubleValue)
24.Math.sqrt(int intValue)
25.Math: tan(double doubleValue)
26.Math: toDegrees(double theta)
27.Math: toRadians(double theta)