LargestInteger.java 502B

123456789101112131415161718192021
  1. public class LargestInteger {
  2. public Integer findLargestNumberUsingConditional(Integer[] integers){
  3. int one = integers[0] > integers[1] ? integers[0] : integers[1];
  4. int two = one > integers[2] ? one : integers[2];
  5. System.out.println(two);
  6. return two;
  7. }
  8. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  9. return Math.max(integers[0],Math.max(integers[1],integers[2]));
  10. }
  11. }