-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
27 lines (21 loc) · 809 Bytes
/
Copy pathSolution.java
File metadata and controls
27 lines (21 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Arrays;
class Solution {
public int solution(int[] numbers) {
// System.out.println(numbers); 이렇게 하면 주소값이 나옴.
// System.out.println(Arrays.toString(numbers));
// 이렇게 해야 배열의 값이 나옴
int max1 = 0;
int max2 = 0;
for (int i = 0; i < numbers.length; i++) {
// System.out.println(numbers[numbers[i]]);
if (max1 < numbers[i]) {
max2 = max1;
max1 = numbers[i];
}
}
System.out.println("max1: " + max1);
System.out.println("max2: " + max2);
System.out.println("max1 * max2: " + max1 * max2);
return max1 * max2;
}
}