|
@@ -5,12 +5,25 @@ public class LargestInteger {
|
5
|
5
|
|
6
|
6
|
public Integer findLargestNumberUsingConditional(Integer[] integers){
|
7
|
7
|
|
8
|
|
- return null;
|
|
8
|
+ int big = 0;
|
|
9
|
+ int x = integers[0];
|
|
10
|
+ int y = integers[1];
|
|
11
|
+ int z = integers[2];
|
|
12
|
+
|
|
13
|
+ if ( x>y && x>z ){
|
|
14
|
+ big = x;
|
|
15
|
+ } else if (y>x && y>z){
|
|
16
|
+ big = y;
|
|
17
|
+ } else if (z>x && z>y) {
|
|
18
|
+ big = z;
|
|
19
|
+ }
|
|
20
|
+
|
|
21
|
+ return big;
|
9
|
22
|
|
10
|
23
|
}
|
11
|
24
|
|
12
|
25
|
public Integer findLargestNumberUsingMathMax(Integer[] integers){
|
13
|
|
- return null;
|
|
26
|
+ return Math.max(integers[0],Math.max(integers[1],integers[2]));
|
14
|
27
|
}
|
15
|
28
|
|
16
|
29
|
}
|