[Q] Calculating distance between two points, using latitude longitude?

I am trying to calculate distance between two points using java code, I have written a code but it is not working. I have checked various forums to get the resolution to my query. I have found specifically posted on this forum and hope I'll get a solution from the member of this community.

Here is code

Code:
final double RADIUS = 6371.01; double temp = Math.cos(Math.toRadians(latA)) * Math.cos(Math.toRadians(latB)) * Math.cos(Math.toRadians((latB) - (latA))) + Math.sin(Math.toRadians(latA)) * Math.sin(Math.toRadians(latB)); return temp * RADIUS * Math.PI / 180;

Show Accepted Answer

Guest Quick Reply (No URL, BBcode or HTML)

Last post by elva.legros
4 hours ago
Last post by lkautzer
1 hour ago
Last post by hessel.annabel
3 hours ago
Last post by sylvester55
2 hours ago
Last post by matt40
3 hours ago
Last post by concepcion.koepp
4 hours ago
Last post by rice.whitney
3 hours ago
Last post by houston05
53 minutes ago
Last post by lind.fred
4 hours ago
Last post by adrain.feeney
1 hour ago
Last post by award
1 hour ago