1234567891011121314151617 |
- import java.util.Scanner;
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
- int largestNumber = integers[0];
- for(int i = 1; i < integers.length; i++){
- if(integers[i] > largestNumber)
- largestNumber = integers[i];
- }
- return largestNumber;
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
- return Math.max(integers[0], Math.max(integers[1], integers[2]));
- }
- }
|