how would I convert the sqrt(x2 − x1)^2 (y2 − y1)^2 to proper java code [closed]

StackOverflow https://stackoverflow.com/questions/15123419

  •  16-03-2022
  •  | 
  •  

How would I convert the equation for the distance between two points:

sqrt((x2 − x1)^2 + (y2 − y1)^2) 

into proper Java code?

有帮助吗?

解决方案

You can use Math.pow and Math.sqrt of package java.lang.Math

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top