Android examples for java.lang:Math Formula
Formula to calculate distance
//package com.java2s; public class Main { private static double result; public static double distance(double x1, double x2, double y1, double y2) { result = (Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))); return result; }//ww w .j a v a2 s . c om }