You could also you Point2D Java API class:
public static double distance(double x1, double y1, double x2, double y2)
Example:
double distance = Point2D.distance(3.0, 4.0, 5.0, 6.0);
System.out.println("The distance between the points is " + distance);