LargestInteger.java 568B

1234567891011121314151617181920212223242526272829303132
  1. public class LargestInteger {
  2. public Integer findLargestNumberUsingConditional(Integer[] integers){
  3. int large = integers[0];
  4. for (int i = 0; i < integers.length ; i++){
  5. if (large < integers[i]){
  6. large = integers[i];
  7. }
  8. }
  9. return large;
  10. }
  11. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  12. return Math.max(integers[0], Math.max(integers[1], integers[2]));
  13. }
  14. }