//Calculating distance between 2 points, two interchangeable versions
//ver1 - with temp vars
public double dist(int x1, int y1, int x2, int y2) {
    int dx = x1 - x2;
    int dy = y1 - y2;
    double res = Math.sqrt(dx*dx + dy*dy);
    return res;
}

//ver2 - no temp vars
public double dist(int x1, int y1, int x2, int y2) {
    return Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}