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