J. Moritz

Greenhorn
+ Follow
since Nov 18, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by J. Moritz

Thanks Mark!
19 years ago
finding the minimum and maximum values of an array while still retaining their original corresponding indices:

19 years ago
Mike...thanks for taking the time to explain.

Coding it is the hard part. I haven't tried your way yet. I've been using nested for loops to take the last indices and run each other indices against it once the other indices get incremented in the outside loop. I keep getting out of bounds errors that way.

I'll try your way.. looks like this one is gonna be another all-nighter! coffee time!

Thanks man!
19 years ago
I've been working on this problem all evening and any help would be appreciated.

I have a 5 element array (of type integer). I need to find the element of the array that holds the maximum value and keep the original corresponding index of that element. The Arrays.sort won't work on this one becuase the index changes for the element with the maximum value once the elements are sorted in ascending order.

Can anyone give me any example code? I just can't figure it out.. I've tried nested loops and etc..

Thanks
19 years ago
Hi again,

The sort method of the Arrays class works perfectly, but what I need is a way to find the minimum and maximum values of an array and print these values onscreen with their corresponding index number (non-sorted index numbers).

Thanks
19 years ago
Hi again,

The sort method of the Arrays class works perfectly, but what I need is a way to find the minimum and maximum values of an array and print these values onscreen with their corresponding index number (non-sorted index numbers).

Thanks
19 years ago
Better?
19 years ago
Thanks for your responses? How am I breaking policy with this name? I'll change it but I was not aware I was breaking a policy of this forum.

Thank you Joyce for your answer. That's what I was looking for.
19 years ago
Hi java ranchers,

Is there a method that will help me to arrange the elements (primitive integer elements) of an array so that the lowest value is at array index 0 and the highest value is at the last index of the array?
19 years ago