Here you can find the source of Distance(int X1, int X2, int Y1, int Y2)
public static double Distance(int X1, int X2, int Y1, int Y2)
//package com.java2s; //License from project: Creative Commons License public class Main { public static double Distance(int X1, int X2, int Y1, int Y2) { return Math.sqrt(Exp2(X1 - X2) + Exp2(Y1 - Y2)); }// w w w .jav a 2 s . c o m public static int Exp2(int a) { return (a * a); } }