Geo { public static double bearing(double lat1, double lon1, double lat2, double lon2) { final double lat1r = Math.toRadians(lat1); final double lat2r = Math.toRadians(lat2); final double delta_lon = Math.toRadians(lon2 - lon1); final double y = Math.sin(delta_lon) * Math.cos(lat2r); final double x = Math.cos(lat1r) * Math.sin(lat2r) - Math.sin(lat1r) * Math.cos(lat2r) * Math.cos(delta_lon); return Math.toDegrees(Math.atan2(y, x)); }  static double distance(double lat1, double lon1, double lat2, double lon2); static double fastDistance(double lat1, double lon1, double lat2, double lon2); static double bearing(double lat1, double lon1, double lat2, double lon2); @NonNull static LatLng moveDirection(double latitude, double longitude, double bearing, double distance);  }
@Test public void bearing() { assertEquals(bearing, Geo.bearing(seattle.latitude, seattle.longitude, la.latitude, la.longitude), 0.01); }