Java Math.hypot(double x, double y)
Syntax
Math.hypot(double x, double y) has the following syntax.
public static double hypot(double x, double y)
Example
In the following code shows how to use Math.hypot(double x, double y) method.
//from ww w .ja va 2 s.c o m
public class Main {
public static void main(String[] args) {
double x = 123456.7;
double y = -123.45;
// call hypot and print the result
System.out.println("Math.hypot(" + x + "," + y + ")=" + Math.hypot(x, y));
}
}
The code above generates the following result.