code: public static final double distance(double lat1, double lon1, double lat2, double lon2)
      {
          checkLatitude(lat1);
          checkLongitude(lon1);
          checkLatitude(lat2);
          checkLongitude(lon2);
          if (
                  (Math.abs(lat1 - lat2) > 100) ||
                  (Math.abs(lon1 - lon2) > 100)
                  )
          {
              return GreatCircle.distance(lat1, lon1, lat2, lon2);
          }
          double dep = departure(lat1, lat2);
          return 60*Math.hypot(
                  lat1-lat2,
                  dep*(lon1-lon2)
                  );
      }
docs: Returns distance between (lat1, lon1) and (lat2, lon2) in NM
  @param lat1
  @param lon1
  @param lat2
  @param lon2
  @return