public static double getAngle(int lon1, int lat1, int lon2, int lat2) {
        final double xdiff = lat2 - lat1;
        final double ydiff = lon2 - lon1;
        return Math.toDegrees(Math.atan2(ydiff, xdiff));
    }
Calculate the angle defined by 3 points
(and deliver it's cosine on the fly)
main/src/main/java/cgeo/geocaching/brouter/util/CheapAngleMeter.java