find max in java

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

showing results for - "find max in java"
Valentino
20 Jan 2017
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
Bianca
06 Jun 2017
1public class Test { 
2
3   public static void main(String args[]) {
4      System.out.println(Math.max(12.123, 12.456));      
5      System.out.println(Math.max(23.12, 23.0));  
6   }
7}
Ben
17 Mar 2019
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 how to use max in javainteger minimum value javalength minimum in javamax in jvajava get max value by strem 40max javafind max value in string javajava max valuehow to do minimum in javafind minimum value in javaminimum in javareturn max javajava max numberfinding max value in javajava max of instancejava find the maxmaximum integer value in javajava maxcreating a max function in javajava string max lengthjava max value functionmax and min javamaximum value in javaimport max of javamax integer javahow to create max function in javafunction for max in java get the minimum value in javaminimum of 3 numbers in javaminimum vlaue of integer in javamax 28 29 in javamax value method javafind min number javafunction to return bigger nteger in javawhat library contains max 28 29 in javamax of int value in javawhat is maximum number in an integer javafinding minimum and maximum numbers javamax 3d 28a 3e b 29 3f a 3a b 3b javajava maximum functionmax method javasmaximum value javamax value javamax number in programing javahow to find max and min in javajava max value of variablehow to write max function in javamath max 28 29 math min 28 29 javajava math get greatest integermax in javajava to find maxmaxvalue 28 29 javamax function jaamethod max javamax in java implementationjava get max numberfind max in javainteger maximum value in javamax of in javajava method max lenghtmax integer javamax val in javajava max 28 29java set maxwhat is the maximum possible length of an string in javahow can i get maximum in java 3fjava find max of two numbersmax 28 29 in javamax of integers javamax number fuctions in javahow to use math max in javajava util math maxfunction to find maximum in javafind max in java arraymax java integerjava max number valuemax between two numbers in javajava program to find maximum and minimummax of javaget element with max value javajava math maxfind the minimum javamaxn javaget maximum in javamax number in javajava maxlenghtfind maximum number in array javaimport math max javajava highest number possiblejava program to find maximum and minimum numbermax function javahow to define max value in javamax min in javafind max of two numbers javafind maximum integer in a stringmath maximum value in javajava maximum of two integersjava generic find maxhow to find min in javamax java numbermaximum function in javahow to return max value in javamax func in javajava max methodjava maximumjava max finctioncalculate minimum javajava max and minjava max of two intsjava how to find max value methodjava max getjava max valueget max val in java in o 281 29finding highest number in javareturn max number in java stringmath max javacheck the maximum variable in javajava how to find max valuemax value in javamax value for lomg in java max in javamax number java arrayhow to assign maximum value to a variable in javahow to find minimum number in javamax 28 29 javafinding max java if statementmax of 2 numbers in javamax funtion javahow to calculate maximum in javajava maximymmath max function in javamaximum int value in javamax fun in javafinding max javamaximum method in javahow to find max to min in javajava maxvaluejava maxerrsjava method max max javafind max without for javamaximum value javajava max mathjava find max ivaluemax value function in javahow to find maximum value in javahow to calculate max of anything in javahow to use max function in javaget max value javahow to call max value in javajava max valuesmax function in javamax min javajava max val math max javasmethod maxhow to calculate the max in javafind minimum value in string in javaminimum integer in javamaximum in javamax programing in javajava maxiumumfind maximum number in javamax fucntion javadefine minimum value in javajava built in max functionmax funaction in javahow return bigger int in javajava maximum valuewhat happens when you math max equal valuesjava maxfind max method javamaxof function in java max 28 29 javahow to get max value in javahow to find max and min number in javamax of 2 integers javareturnmax javahow to take max value in javaget maximum value in javafind max value javacompare the max javajava max int functionmaximum of javamax size javawhat is max value in javamax between two numbers javamax syntax javamax element in javato find max in java maximum javareturn max value of two ints javafind the minimum among 10 numbers in javawhat is the maximum value of an integer in javajava min max minimum of values javajava get max valuejava find max valuefind max javamax value javamax and javamaximum javamax method in javamax javemaxvalueof in javamax funcartion in javajava math max more numbersjava max value of a variable find maximum number that can be formed using digits of a given number in javajava max funcitonmath methode to find maximum value javawhen does max value of and operation java minimum integer javaget max from a and b javaint minimum value javadefine max javamax funciton javamax value javafinding max in javafind maximum value javafind maximum value in javajava minimum integerwhat does max mean in javajava max valyejava maxeersmath max int anf floatmath max function javamax method javamaxvalue in javajava max functionmax elements in javamaximum int javamax integer in javaidentify maximum integer in a stringjava highest numbermax number integer javamax value of int in javamax in java 8java max function intmaximum number javahow to use max value in javajava get max of 2 numbersmax value in javaminimum int value javamax in maths in javathe max in javamax in javamax value in javamax value in java shortjava find max of 3 numbersmaximum value of string in javamax and index javamath max 28 int 2c float 29use max 28 29 in javajava max of 4 valuesmax of function in javajava find maxwhat is the greatest number in java when getting min numbermaxen javajava get max of inputmax keyword in javaminimum int javajava bigger methosmax en javaimport math in java for max and minmax javafind minimum of 3 numbers javamax valeur in javamaths maxmax value in java methodsminimum value javajava max 28 29 methodhow to find max element in javafind max in java