Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. double lat1=50.322852;
  2.         double lon1=3.513506;
  3.         double lat2=50.322894;
  4.         double lon2=3.513701;
  5.  
  6.        
  7.         double e=(3.14159265358979*lat1/180);
  8.         double f=(3.14159265358979*lon1/180);
  9.         double g=(3.14159265358979*lat2/180);
  10.         double h=(3.14159265358979*lon2/180);
  11.         double ii=(Math.cos(e)*Math.cos(g)*Math.cos(f)*Math.cos(h)+Math.cos(e)*Math.sin(f)*Math.cos(g)*Math.sin(h)+Math.sin(e)*Math.sin(g));
  12.         double jj=(Math.acos(ii));
  13.         double k=6371*jj;
  14.        
  15.         System.out.println("km:"+k+" m:"+k*1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement