123456789101112131415161718192021222324252627282930 |
-
-
-
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
-
- int big = 0;
- int x = integers[0];
- int y = integers[1];
- int z = integers[2];
-
- if ( x>y && x>z ){
- big = x;
- } else if (y>x && y>z){
- big = y;
- } else if (z>x && z>y) {
- big = z;
- }
-
- return big;
-
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
- return Math.max(integers[0],Math.max(integers[1],integers[2]));
- }
-
- }
|