Sep 04, 2015 · public static int getMax(int max,int[] arr ){ int pos=0; //Looping n-1 times, O(n) for( int i = 0; i < arr.length; i++) // Iterate through the First Index and compare with max { // O(1) if( max < arr[i]) { // O(1) max = arr[i];// Change max if condition is True pos=i; } } arr[pos]=0; return max; } public static void main(String[] args) { int large[]=new int[10];** int** array[] = {33,55,13,46,87,42,10,34,43,56}; int k=0; for(int i=0;i<array.length;i++){ large[k++]=getMax(0,array); } System.out ....

2020. 6. 16. · Example. Live Demo. public class MinAndMax { public** int** max(int [] array) {** int max** = 0; for(int i=0; i<array.length; i++ ) { if(array[i]>max) {** max** = array[i]; } } return max; } public** int** min(int [] array) {** int** min = array[0]; for(int i=0; i<array.length; i++ ) { if(array[i]<min) { min = array[i]; } } return min; } public static void main(String.

Arrays.**sort**(**array**); System.out.println("sorted **Array**::"+Arrays.toString(**array**)); int **max** = **array**[size-3]; System.out.println("3rd largest element is :"+**max**); } }. Steps to **find** **maximum** and minimum **values** in a list : Get the total count of the numbers from the user. Using a loop, get the inputs of the numbers. Add these numbers to a list. Now ....