LargestInteger.java 517B

123456789101112131415161718192021222324
  1. import java.lang.*;
  2. public class LargestInteger {
  3. public Integer findLargestNumberUsingConditional(Integer[] integers){
  4. Integer largest = 0;
  5. for (int i=0;i<integers.length;i++){
  6. if (integers[i]>largest)
  7. largest = integers[i];
  8. }
  9. return largest;
  10. }
  11. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  12. int x = 300;
  13. int y = 200;
  14. int z = 600;
  15. return Math.max(Math.max(x,y),z) ;
  16. }
  17. }