Here you can find the source of distance(int fx, int fy, int sx, int sy)
public static double distance(int fx, int fy, int sx, int sy)
//package com.java2s; //License from project: Open Source License public class Main { public static double distance(int fx, int fy, int sx, int sy) { final int dx = sx - fx; final int dy = sy - fy; return Math.sqrt(dx * dx + dy * dy); }/*from www . ja v a2 s . c om*/ }