123456789101112131415161718192021222324252627282930
  1. public class LargestInteger {
  2. public Integer findLargestNumberUsingConditional(Integer[] integers){
  3. int big = 0;
  4. int x = integers[0];
  5. int y = integers[1];
  6. int z = integers[2];
  7. if ( x>y && x>z ){
  8. big = x;
  9. } else if (y>x && y>z){
  10. big = y;
  11. } else if (z>x && z>y) {
  12. big = z;
  13. }
  14. return big;
  15. }
  16. public Integer findLargestNumberUsingMathMax(Integer[] integers){
  17. return Math.max(integers[0],Math.max(integers[1],integers[2]));
  18. }
  19. }