LargestInteger.java 511B

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