find maximum number in java

Solutions on MaxInterview for find maximum number in java by the best coders in the world

showing results for - "find maximum number in java"
Bryson
26 Jan 2019
1int[] arr = {2, 3, 4, 5, 6, 7, 8, 9,};
2        int max = arr[0]; // max tanimliyorsun
3        int min = arr[0];  // min tanimliyorsun
4
5        for (int i = 0; i < arr.length; i++) {
6            if (arr[i] > max){ 
7// array's index are compared with each other,
8// whichever is greater will be assigned to max
9                max = arr[i];
10            }
11            if(arr[i] < min){ 
12//array's index are compared with each other,
13// whichever is smaller will be assigned to min
14                min = arr[i];
15            }
16        }
17        System.out.println(max); // 9
18        System.out.println(min);  // 2
Elizabeth
12 Oct 2016
1        int[] arr = {2, 3, 4, 5, 6, 7, 8, 9,};
2        int max = arr[0]; // max tanimliyorsun
3        int min = arr[0];  // min tanimliyorsun
4
5        for (int i = 0; i < arr.length; i++) {
6            if (arr[i] > max){ 
7// array's index are compared with each other,
8// whichever is greater will be assigned to max
9                max = arr[i];
10            }
11            if(arr[i] < min){ 
12//array's index are compared with each other,
13// whichever is smaller will be assigned to min
14                min = arr[i];
15            }
16        }
17        System.out.println(max); // 9
18        System.out.println(min);  // 2
queries leading to this page
getting max number in javajava how to find max integer minimum value javalength minimum in javajava get max value by stremfind max value in string javajava max valuehow to do minimum in javafind minimum value in javaminimum in javajava find the maxjava maxmaximum integer value in javafunction for max in java get the minimum value in javaminimum of 3 numbers in javahow to return minimum value in javaminimum vlaue of integer in javamax 28 29 in javafind min number javamax of int value in javawhat is maximum number in an integer javafinding minimum and maximum numbers javamaximum value javamax value javamax number in programing javahow to find max and min in javamax in javajava get max numberfind max in javainteger maximum value in javawhat is the maximum possible length of an string in javahow can i get maximum in java 3fmax number fuctions in javafunction to find maximum in javafind max in java arrayjava program to find maximum and minimumget element with max value javafind the minimum javaget maximum in javamax number in javafind maximum number in array javajava highest number possiblejava program to find maximum and minimum numbermax function javafind max of two numbers javafind maximum integer in a stringjava generic find maxhow to find min in javamax java numberhow to return max value in javamax func in javajava max methodcalculate minimum javajava how to find max value methodjava max valueget max val in java in o 281 29finding highest number in javareturn max number in java stringcheck the maximum variable in javajava how to find max valuemax value for lomg in javahow to assign maximum value to a variable in javahow to find minimum number in javafinding max java if statementhow to calculate maximum in javamaximum int value in javamax fun in javamaximum method in javahow to find max to min in javafind max without for javamaximum value javajava find max ivaluemax value function in javahow to find maximum value in javahow to calculate max of anything in javamax function in javahow to calculate the max in javafind minimum value in string in javaminimum integer in javamaximum in javamax programing in javafind maximum number in javadefine minimum value in javajava built in max functionhow to get max value in javahow to find max and min number in javaget maximum value in javafind max value javamax element in java maximum javafind the minimum among 10 numbers in javawhat is the maximum value of an integer in javaminimum of values javafind max javamaximum javajava find max valuemax method in javamax funcartion in javafind maximum number that can be formed using digits of a given number in javamath methode to find maximum value javawhen does max value of and operation java minimum integer javaint minimum value javamax value javafind maximum value in javafind maximum value javajava minimum integermax elements in javamaximum int javamax integer in javaidentify maximum integer in a stringjava highest numbermax number integer javamax value of int in javamaximum number javamax value in javaminimum int value javamax value in javamax value in java shortjava find max of 3 numbersmaximum value of string in javamax and index javajava find maxwhat is the greatest number in java when getting min numberjava get max of inputminimum int javamax javafind minimum of 3 numbers javamax valeur in javamax value in java methodsminimum value javajava max functionhow to find max element in javafind maximum number in java