package max; public class Max { private static int[] numbers = {20, 50, 23, 42, 1, 24, 53, 13, 56}; public static int max(int[] data) { int bestGuess = data[0]; for (int i = 1; i < data.length; i++) { if (data[i] > bestGuess) { bestGuess = data[i]; } } return bestGuess; } public static void main(String[] args) { System.out.println("max = " + max(numbers)); double x1 = 37.8; // latitude of San Francisco double y1 = -122.4; // longitude of San Francisco double x2 = 48.87; // latitude of Paris double y2 = 2.33; // longitude of Paris double sines = Math.sin( Math.toRadians(x1) ) * Math.sin( Math.toRadians(x2) ); double cosines = Math.cos( Math.toRadians(x1)) * Math.cos(Math.toRadians(x2)) * Math.cos( Math.toRadians(y1 - y2)); double distance = 69.1105 * Math.toDegrees(Math.acos( sines + cosines )); System.out.println( "distance = " + distance ); } }