class Geo {

    @NonNull
    public static LatLng moveDirection(double latitude, double longitude, double bearing, double distance) {
        final double d = distance / R;

        final double lat = Math.toRadians(latitude);
        final double lon = Math.toRadians(longitude);
        final double bear = Math.toRadians(bearing);

        // Precompute trig
        final double sin_d = Math.sin(d);
        final double cos_d = Math.cos(d);
        final double sin_lat = Math.sin(lat);
        final double cos_lat = Math.cos(lat);
        final double sin_d_cos_lat = sin_d * cos_lat;

        final double lat2 = Math.asin(sin_lat * cos_d + sin_d_cos_lat * Math.cos(bear));
        final double lon2 = lon + Math.atan2(Math.sin(bear) * sin_d_cos_lat, cos_d - sin_lat * Math.sin(lat2));

        final double lat3 = Math.toDegrees(lat2);
        final double lon3 = mod360(Math.toDegrees(lon2));

        return new LatLng(lat3, lon3);
    }

}