1234567891011121314151617181920212223242526272829 |
-
-
-
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
-
- Integer max = new Integer(Integer.MIN_VALUE);
-
- for (int i = 0; i <integers.length; i++) {
-
- if (max < integers[i]) {
- max = integers[i];
- }
- }
- return max;
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
-
- int max = Integer.MIN_VALUE;
-
- for (int i = 0; i < integers.length; i++) {
- max = Math.max(max, integers[i]);
- }
- return max;
- }
- }
|