Law of Haversine ============================== https://www.movable-type.co.uk/scripts/latlong.html private static final int EARTH_RADIUS = 6371000; // meters double dLat = Math.toRadians(that.lat - this.lat); double dLon = Math.toRadians(that.lon - this.lon); double a = Math.sin(dLat / 2.0) * Math.sin(dLat / 2.0) + Math.cos(Math.toRadians(this.lat)) * Math.cos(Math.toRadians(that.lat)) * Math.sin(dLon / 2.0) * Math.sin(dLon / 2.0); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); return EARTH_RADIUS * c; The haversine formula1 ‘remains particularly well-conditioned for numerical computa­tion even at small distances’ – 1.2.30 Generate 5 random numbers ============================ read 5 int values, print average 1.2.34 3-sort ============================= Read 3 integer command-line arguments, print in sorted order. Use Math.min(), Math.max() no if statements 5. Type conversion. CMYK to RGB ============================ https://stackoverflow.com/questions/4858131/rgb-to-cmyk-and-back-algorithm define white = ... public static int[] cmykToRgb(int cyan, int magenta, int yellow, int black) { if (black!=255) { int R = ((255-cyan) * (255-black)) / 255; int G = ((255-magenta) * (255-black)) / 255; int B = ((255-yellow) * (255-black)) / 255; return new int[] {R,G,B}; } else { int R = 255 - cyan; int G = 255 - magenta; int B = 255 - yellow; return new int[] {R,G,B}; } } Projectile motion formulas ====================================== https://en.wikipedia.org/wiki/Projectile_motion