/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
List<Integer> routeLine = new ArrayList<Integer>();
routeLine.add(0);
routeLine.add(1);
routeLine.add(2);
routeLine.add(3);
routeLine.add(4);
routeLine.add(5);
String result
= Arrays.
toString(routeLine.
subList(4,
6).
toArray());
//Baidu
// result = String.valueOf(gps2d(24.189407,120.710013,24.189367,120.71));
// result = String.valueOf(gps2d(24.189407,120.710013,24.188386,120.710014));
//Google
result
= String.
valueOf(gps2d
(6.059924,
125.417117,
-35.954718,
85.338992));
}
private static double gps2d(double lat_a, double lng_a, double lat_b, double lng_b) {
double d = 0;
d
=Math.
cos(lat_b
)*Math.
sin(lng_b
-lng_a
)/d
;
if (lat_b >= lat_a) {
if (d < 0) {
d = 360 + d;
}
} else {
d = 180 - d;
}
// d = Math.round(d*10000);
return d;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCUxpc3Q8SW50ZWdlcj4gcm91dGVMaW5lID0gbmV3IEFycmF5TGlzdDxJbnRlZ2VyPigpOwoJCXJvdXRlTGluZS5hZGQoMCk7CgkJcm91dGVMaW5lLmFkZCgxKTsKCQlyb3V0ZUxpbmUuYWRkKDIpOwoJCXJvdXRlTGluZS5hZGQoMyk7CgkJcm91dGVMaW5lLmFkZCg0KTsKCQlyb3V0Z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