Java Math acos() Method

❮ Math Methods


Example

Return the arc cosine of different numbers:

System.out.println(Math.acos(0.64));
System.out.println(Math.acos(-0.4));
System.out.println(Math.acos(0));
System.out.println(Math.acos(1));
System.out.println(Math.acos(-1));
System.out.println(Math.acos(2)); 

Try it Yourself »


Definition and Usage

The acos() method returns the arc cosine value of a number.

Tip: acos(-1) returns the value of PI.


Syntax

public static double abs(double number)

Parameter Values

Parameter Description
number Required. A number to find the arc cosine of, in the range -1 to 1. If the value is outside -1 to 1, it returns NaN (Not a Number).

Technical Details

Returns: A double value, representing the arc cosine of a number

❮ Math Methods
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.