# Find cos of angle or cos inverse Java

cos(double a) method can be used to find the cosine of an angle and acos(double a) method can be used to find the cos inverse or arc cosine of an value in Java.

cos(double a) and acos(double a) methods belongs to Math class of java.lang package and both are static, so it can be called directly using class name without creating object.

## cos(double a)

static double cos(double a) method since it is static we can call directly using class name Math. e.g Math.cos(60).

Parameter 'a' value should be the angle in radians. The method returns the cosine value of the angle.

### Example

class MathTest{

public static void main(String args[]){

double angle=60;

double cosoa=Math.cos(angle);

System.out.println("CoSine of the angle is "+cosoa);

}

}

### Output

CoSine of the angle is 0.8634149422749642

## acos(double a)

static double acos(double a) method is used to find the cos inverse of the value. Since it is static we can call directly using class name Math. e.g Math.acos(1).

Parameter 'a' value should be the value whose arc cosine is to be determined. The method returns the cosine inverse of the value in radians.

Returned value will be between 0 and pi.

### Example

class MathTest{

public static void main(String args[]){

double val=0;

double acosov=Math.acos(val);

System.out.println("CoSine inverse or arc cosine of the value is "+acosov);

}

}

### Output

CoSine inverse or arc cosine of the value is 1.5707963267948966