Check out example codes for "distance between two points java". It will help you in understanding the concepts better.
Code Example 1
static double distance(int x1, int y1, int x2, int y2)
{
// Calculating distance
return Math.sqrt(Math.pow(x2 - x1, 2) +
Math.pow(y2 - y1, 2) * 1.0);
}
Learn ReactJs, React Native from akashmittal.com