Link to home
Start Free TrialLog in
Avatar of epifanio67
epifanio67

asked on

Java: in a loop, is there a way to get the lowest and highest number? the loop is of type Integer

Hello Experts,

In a loop, is there a way to get the lowest and highest number in a loop?

for (int y = 0; y < 10; y++) {
      //how do I print/get/assign the lowest number on this loop?
      //how do I print/get/assign the highest number on this loop?            
}

notes:
y is an arrayList<Integer>
the size of y will vary, it may  begin at 50 to 500,000

I want to get the lowest number to assign it to a variable and
I want to get the highest number to assign it to a variable....

In advance, thanks for your help...

Regards,
SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of epifanio67
epifanio67

ASKER

Thank you experts...

I appreciate your help...
Regards,