Degree to Radian, and Radian to Degree
static double toDegrees(double angrad)
- Converts an angle in radians to an angle measured in degrees.
static double toRadians(double angdeg)
- Converts an angle in degrees to an angle measured in radians.
public class Main {
public static void main(String[] args) {
System.out.println(Math.toDegrees(1.2));
System.out.println(Math.toRadians(-1.2));
}
}
The output:
68.75493541569878
-0.020943951023931952
public class Main {
public static void main(String args[]) {
double theta = 120.0;
System.out.println(theta + " degrees is " + Math.toRadians(theta) + " radians.");
theta = 1.312;
System.out.println(theta + " radians is " + Math.toDegrees(theta) + " degrees.");
}
}
The output:
120.0 degrees is 2.0943951023931953 radians.
1.312 radians is 75.17206272116401 degrees.
Home
Java Book
Essential Classes
Java Book
Essential Classes
Math:
- Math class
- Constant E and PI
- Get the absolute value
- sin, cos, tan: Trigonometric functions
- Cube root and square root
- Ceilling and flooring value
- Copy sign
- Raise the power
- Get exponent
- sqrt(x2 +y2)
- IEEE remainder
- logarithm
- Max, min value
- Next value
- Math Random
- Round to int to double
- Round a value to integer
- value * 2^ scaleFactor
- Get the sign
- Degree to Radian, and Radian to Degree
- Returns the size of an ulp of the argument