Spherical Cosinus Haversine Formula Android studio : So currently i write a function haversine formula to calculate distance for 2 coordinate, and i find this code but i dont know how to write it in android. here is the function that i will created. this 


    private double SphericalCosinus(double lat1, double long1, double lat2,
			double long2) {
		//formula
	}
and the formula is this one, there is some tutorial that tell me to use math libarary but i always write the code wrong because the apps didnt show the location. here is the formula i get

    =(6371.1*((2*ASIN(SQRT((SIN((RADIANS(lat2)-RADIANS(lat1))/2)^2)+COS(RADIANS(lat2))*COS(RADIANS(lat1))*(SIN((RADIANS(long2)-RADIANS(long1))/2)^2))))))