Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

finding a minimum value in an array without using loops

807603Feb 7 2008 — edited Feb 7 2008
I can find a minimum value in an array using a loop, but I am unsure of how to do it without any type of of loop

Here is what I have using a loop:

// This method searches for the minimum value in an array
public static int min(int a[]){
int min = a[0];

for(int i = 1; i < a.length; i++){
if(a[i] < min){
min = a;
}
}
return min;
}

How do I covert this to do the same thing, using no loops?

Thank you for replies

Edited by: kazmania on Feb 7, 2008 12:26 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2008
Added on Feb 7 2008
9 comments
879 views