The method adapts rectangular directs (x, y) to polar manage (r, theta) and returns theta. atan2() is an inbuilt process in Java that is utilized to return the theta constituent from the polar coordinate.
double atan2(double y, double x)
Here is the detail of parameters −
Example
public class Test { public static void main(String args[]) { double x = 45.0; double y = 30.0; System.out.println( Math.atan2(x, y) ); } }
This will produce the following result:
0.982793723247329