public static String max(String[] arr) { String result = arr[0]; for (int i = 1; i < arr.length; ++i) { if (result.compareTo(arr[i]) < 0) result = arr[i]; } return result; }