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