package com.codegym.task.task07.task0701; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; /* Maximum in an array */ public class Solution { public static void main(String[] args) throws Exception { int[] array = initializeArray(); int max = max(array); System.out.println(max); } public static int[] initializeArray() throws IOException { Scanner sc = new Scanner(System.in); int[] numbers = new int[20]; //Created an array of 20 numbers for (int i = 0; i < numbers.length; i++){ numbers[i] = sc.nextInt(); } // Geting the max number of the array int max = numbers[0]; for (int index = 1; index < numbers.length; index++){ if (numbers[index] > max){ max = numbers[index]; //sumArray[i]= R1[i]+ R2[j]; // updated line } } return max; } public static int max(int[] array) { // Find the maximum return 0; } }