# Java – Find Arc Cosine – acos() Method – Examples & Explanation

`java.lang.Math.acos()` method is used to find the arc cosine of a double value in Java for the given input (`x` – parameter).
The returned angle is in the range 0.0 through PI (22/7).
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

`acos()` method exists in `Math` class of `java.lang` package.
Since: JDK1.0

## Declaration of `acos()` Method

The declaration of `acos()` method is:

## Syntax of `acos()` Method

The syntax of `acos()` method in Java is:

Example

Output:
` 1.0471975511965979 `
Example
By importing `java.lang` package the syntax of `acos()` method can be used as:

Output:
` 1.0471975511965979 `

## Parameters of `acos()` Method in Java

`x` – Where `x` is any valid double input value. This parameter is required.

## Error Handling

If the `x` parameter is not a number `acos()` method returns an `error`.
If there is no argument (`x` – input value) passes to the method, the compiler will produce an `error`.
Example

Output:
`Error`

## Return Value of `acos()` Method in Java

`acos()` method returns the arc cosine of a double value for the given input (`x` – parameter).

## Java `acos()` Method Example 1

Output:
` arc cosine of a Negative Value: 2.0943951023931957 arc cosine of a Positive Value: 1.0471975511965979 arc cosine of Zero: 1.5707963267948966 `

## Java `acos()` Method Example 2

Output:
` NaN 1.5707963267948966 NaN NaN 1.5707963267520295 NaN 1.5707963267948966 NaN NaN `
NOte : Those values which are not in the range of (0.0 through Pi) will return a NaN value.

## Special Cases of `acos()` Method in Java

If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
Example

Output:
` NaN `