LargestInteger.java 464B

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