LargestInteger.java 509B

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