12345678910111213141516171819202122 |
-
-
-
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
- int largestNum = 0;
- for(int i=0; i<integers.length; i++){
- if(largestNum < integers[i]){
- largestNum = integers[i];
- }
- }
- return largestNum;
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
- int largestNum = Math.max(integers[0], integers[1]);
- int result = Math.max(integers[2], largestNum);
- return result;
- }
- }
|