123456789101112131415161718192021 |
- import java.lang.Math;
- import java.util.Arrays;
-
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
- int largest = 0;
- for (int i = 0; i<integers.length; i++){
- Arrays.sort(integers);
- largest = integers[integers.length-1];
- }
- return largest;
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
- Arrays.sort(integers);
-
- return Math.max(integers[1],integers[2]);
- }
- }
|