FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java_Learning/28_ArrayList/Max.java at main · TORRYNN/Java_Learning · GitHub
TORRYNN
/
Java_Learning
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java_Learning
/
28_ArrayList
/
Max.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (17 loc) · 529 Bytes
Breadcrumbs
Java_Learning
/
28_ArrayList
/
Max.java
Copy path
File metadata and controls
20 lines (17 loc) · 529 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import
java
.
util
.
ArrayList
;
import
java
.
util
.
Arrays
;
public
class
Max
{
public
static
int
max
(
ArrayList
<
Integer
>
arr
) {
int
max
=
Integer
.
MIN_VALUE
;
for
(
int
i
=
0
;
i
<
arr
.
size
();
i
++) {
if
(
arr
.
get
(
i
) >=
max
) {
max
=
arr
.
get
(
i
);
}
}
return
max
;
}
public
static
void
main
(
String
[]
args
) {
ArrayList
<
Integer
>
arr
=
new
ArrayList
<>(
Arrays
.
asList
(
2
,
5
,
9
,
3
,
6
,
9
,
9
,
9
,
8
,
999
,
99
,
101
));
System
.
out
.
println
(
max
(
arr
));
}
}
Back
|
FazBrowse Home
|
New Git URL