fork download
  1.  
  2. public class Main {
  3. // ForExercises
  4.  
  5. public static void main (String[] args) {
  6. int[] array = {10, 20, 100, 50, 3, 2};
  7. int max = array[0];
  8. for (int i = 1; i < array.length; i++) {
  9. if (array[i] > max) {
  10. max = array[i];
  11. }
  12. }
  13.  
  14. System.out.println("max element is: " + max);
  15. }
  16. }
Success #stdin #stdout 0.1s 55732KB
stdin
Standard input is empty
stdout
max element is: 100