LargestInteger.java 572B

123456789101112131415161718
  1. public class LargestInteger {
  2. public Integer findLargestNumberUsingConditional(Integer[] integers){
  3. Integer largerInteger = (integers[0]<integers[1]) ? integers[1]:integers[0];
  4. Integer largestInteger = (largerInteger<integers[2]) ? integers[2]:largerInteger;
  5. return largestInteger;
  6. }
  7. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  8. Integer largerInteger = Math.max(integers[0],integers[1]);
  9. Integer largestInteger = Math.max(integers[1],integers[2]);
  10. return largestInteger;
  11. }
  12. }