12345678910111213141516171819 |
-
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
- int largest = 0;
- for (int i = 0; i < integers.length; i++){
- largest = integers[i] > largest ? integers[i] : largest;
- }
- return largest;
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
- int largest = 0;
- for (int i = 0; i < integers.length; i++){
- largest = Math.max(integers[i], largest);
- }
- return largest;
- }
- }
|