LargestInteger.java 450B

123456789101112131415161718
  1. public class LargestInteger {
  2. public Integer findLargestNumberUsingConditional(Integer[] integers){
  3. int first = (integers[0] > integers[1]) ? integers[0] : integers[1];
  4. int second = (first > integers[2]) ? first : integers[2];
  5. return second;
  6. }
  7. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  8. return Math.max(integers[0], Math.max(integers[1],integers[2]));
  9. }
  10. }