+ 1

How can I print the highest number in one array or in one list? Java

Example Int[] ={0,4,8,3}; Print 8

13th Mar 2018, 4:52 PM
mateo quiceno toro
mateo quiceno toro - avatar
9 Respostas
+ 15
https://www.sololearn.com/Discuss/316152/?ref=app //first try yourself ... U'll make yourself easily [without using Arrays.sort ()]
13th Mar 2018, 5:12 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
//import java.util.*; int i[] = {0,4,8,3}; Arrays.sort(i); System.out.println(i[i.length-1]);
13th Mar 2018, 5:47 PM
D_Stark
D_Stark - avatar
+ 5
you could sort array and use last element. The length() method is very useful for doing this
13th Mar 2018, 5:13 PM
D_Stark
D_Stark - avatar
+ 4
@mateo please explain what you want you would like to do there will be someone who can help ☺. Also array and array lists are diffrent the example i shown was using array, with array lists there one dimensional and you can remove elements.
13th Mar 2018, 9:08 PM
D_Stark
D_Stark - avatar
+ 3
The thing is that I don't know what will put the uswr
13th Mar 2018, 8:38 PM
mateo quiceno toro
mateo quiceno toro - avatar
+ 2
I am not going to give you code but some hints. 1> You should iterate through array ( use for loop ) 2> you need temporary variable to store current maximum number 3> you need if statement comparing current temporary maximum with element in array
13th Mar 2018, 4:59 PM
code learner
code learner - avatar
+ 1
The sort is just 4 lists
13th Mar 2018, 5:37 PM
mateo quiceno toro
mateo quiceno toro - avatar
0
The sort is just 4 lists
13th Mar 2018, 5:33 PM
mateo quiceno toro
mateo quiceno toro - avatar