public class Main {
// ForExercises
public static void main
(String[] args
) { int[] array = {10, 20, 100, 50, 3, 2};
int max = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
}
}
System.
out.
println("max element is: " + max
); }
}
CnB1YmxpYyBjbGFzcyBNYWluIHsKCS8vIEZvckV4ZXJjaXNlcwoJCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgewoJCWludFtdIGFycmF5ID0gezEwLCAyMCwgMTAwLCA1MCwgMywgMn07CgkJaW50IG1heCA9IGFycmF5WzBdOwoJCWZvciAoaW50IGkgPSAxOyBpIDwgYXJyYXkubGVuZ3RoOyBpKyspIHsKCQkJaWYgKGFycmF5W2ldID4gbWF4KSB7CgkJCQltYXggPSBhcnJheVtpXTsKCQkJfQoJCX0KCQoJCQlTeXN0ZW0ub3V0LnByaW50bG4oIm1heCBlbGVtZW50IGlzOiAiICsgbWF4KTsKCX0KfQ==