@@ -0,0 +1,926 @@
+/*%0D%0A * Calculate the distance of two points (from, to) in meter, using latitude and longitude, using Haversine formula.%0D%0A * Reference:%0D%0A * 1. https://en.wikipedia.org/wiki/Haversine_formula%0D%0A */%0D%0A%0D%0Apublic class CalcDistance %7B%0D%0A%09public static double getDistance(double lat1, double lon1, double lat2, double lon2) %7B%0D%0A%09%09double r = 6378137.0;%09// earth radius in meter%0D%0A%0D%0A        lat1 = Math.toRadians(lat1);%0D%0A        lon1 = Math.toRadians(lon1);%0D%0A        lat2 = Math.toRadians(lat2);%0D%0A        lon2 = Math.toRadians(lon2);%0D%0A%0D%0A        double dlat = lat2 - lat1;%0D%0A        double dlon = lon2 - lon1;%0D%0A%0D%0A        double d = 2 * r * Math.asin(Math.sqrt(Math.pow(Math.sin(dlat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon / 2), 2)));%0D%0A%0D%0A%09%09return d;%0D%0A%09%7D%0D%0A%0D%0A    public static void main(String%5B%5D args) %7B%0D%0A%09%09System.out.println(getDistance(23.205402, 120.335066, 23.202188, 120.339733));%09// 596.6710070527057 m%0D%0A%09%7D%0D%0A%7D%0D%0A

add haversine java