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  

Math:
  1. Math class
  2. Constant E and PI
  3. Get the absolute value
  4. sin, cos, tan: Trigonometric functions
  5. Cube root and square root
  6. Ceilling and flooring value
  7. Copy sign
  8. Raise the power
  9. Get exponent
  10. sqrt(x2 +y2)
  11. IEEE remainder
  12. logarithm
  13. Max, min value
  14. Next value
  15. Math Random
  16. Round to int to double
  17. Round a value to integer
  18. value * 2^ scaleFactor
  19. Get the sign
  20. Degree to Radian, and Radian to Degree
  21. Returns the size of an ulp of the argument