public double distance(Double latitude, Double longitude, double e, double f) {
double d2r = Math.PI / 180;
double dlong = (longitude - f) * d2r;
double dlat = (latitude - e) * d2r;
double a = Math.pow(Math.sin(dlat / 2.0), 2) + Math.cos(e * d2r)
* Math.cos(latitude * d2r) * Math.pow(Math.sin(dlong / 2.0), 2)
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
double d = 6367 * c;
return d;
}