- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get the arc cosine of an angle in Java
To get the arc cosine of a given value in Java, we use the java.lang.Math.acos() method. The acos() method accepts a double value whose angle needs to be computed. The range of the angle returned lies in the range 0 to pi. If the argument is NaN or greater than 1 or less than -1 then the result is NaN.
Declaration −The java.lang.Math.acos() method is declared as follows −
public static double acos(double a)
Here, a is the value whose arc cosine is computed.
Let us see a program to get the arc cosine of a given value in Java.
Example
import java.lang.Math; public class Example { public static void main(String[] args) { // get two double numbers in degrees double x = Math.sqrt(3)/2; double y = 0.5; // computing and displaying the arc cosine of these doubles System.out.println("Arc cosine of " + x + " = " + Math.acos(x)); System.out.println("Arc cosine of " + y + " = " + Math.acos(y)); } }
Output
Arc cosine of 0.8660254037844386 = 0.5235987755982989 Arc cosine of 0.5 = 1.0471975511965979
- Related Articles
- Get the arc sine of an angle in Java
- Get the Trigonometric cosine of an angle in Python
- Get the hyperbolic arc-cosine of a floating-point value in C#
- How To Get the Arc Length from Given Angle in Java?
- Find Angle at Centre from Angle at Circumference by an Arc in Java?
- Get the hyperbolic cosine of a given value in Java
- How to find cosine of an angle using Python?
- How to find the Arc Cosine of a given value in Golang?
- Get the arc tangent of a given value in Java
- How to find the Hyperbolic Arc Cosine of a given value in Golang?
- Get the Trigonometric cosine of an array of angles given in degrees with Python
- Get the Trigonometric inverse cosine in Python
- In a circle of radius 21 cm, an arc subtends an angle of $60^o$ at the centre. Find area of the sector formed by the arc.
- How to get the cosine of a number in JavaScript?
- In a circle of radius \( 35 \mathrm{~cm} \), an arc subtends an angle of \( 72^{\circ} \) at the centre. Find the length of the arc and area of the sector.

Advertisements