1234567891011121314151617181920212223242526272829 |
-
-
-
- public class LargestInteger {
-
- public Integer findLargestNumberUsingConditional(Integer[] integers){
- int highest= integers[0];
-
- if(integers[1] > highest){
- highest = integers[1];
- if (integers[2] > highest){
- highest = integers[2];
- }
- }
- else if (integers[2] > highest){
- highest = integers[2];
- }
-
- return highest;
- }
-
- public Integer findLargestNumberUsingMathMax(Integer[] integers){
- int highest= Math.max(Math.max(integers[0],integers[1]), integers[2]);
-
-
- return highest;
- }
- }
|