Java tutorial
//package com.java2s; public class Main { /** * @param x1 * @param y1 * @param x2 * @param y2 * @return */ public final static double calDistance(double x1, double y1, double x2, double y2) { double distance = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); return distance; } }