123456789101112131415161718192021222324252627282930313233343536 |
-
-
- import java.lang.Math;
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
-
- int bigNumber = 0;
-
- for(int i = 0; i < integers.length; i++){
- if(bigNumber < integers[i]){
- bigNumber = integers[i];
-
- }
-
- }
-
- return bigNumber;
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
- /*int small = 0;
- int bigNumber = 0;
- //int answer = Math.max(maximum,bigNumber);
- for(int i = 0; i < integers.length; i++){
- small = 0;
- bigNumber = Math.max(integers[i],integers[i]);
- }
-
- return bigNumber;*/
-
-
- return Math.max(integers[0],Math.max(integers[1],integers[2]));
- }
- }
|