Here you can find the source of calcDistance(int x1, int y1, int x2, int y2)
public static int calcDistance(int x1, int y1, int x2, int y2)
//package com.java2s; //License from project: Open Source License public class Main { public static int calcDistance(int x1, int y1, int x2, int y2) { return (int) Math.ceil(Math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2)); }//from w w w . java 2 s. co m }