Java Data Type Tutorial - Java Math.toDegrees(double angrad)








Syntax

Math.toDegrees(double angrad) has the following syntax.

public static double toDegrees(double angrad)

Example

In the following code shows how to use Math.toDegrees(double angrad) method.

/*from w w  w  . j a va2s  .c  o m*/
public class Main {

   public static void main(String[] args) {

      double x = 0.5;
      double y = -1;

      // convert them in degrees
      x = Math.toDegrees(x);
      y = Math.toDegrees(y);

      System.out.println(x);
      System.out.println(y);

   }
}

The code above generates the following result.