Thursday, January 14, 2010

The Highest Code On Funbrain How To Code Java In Order To Find The Highest Value In An Array?

How to code Java in order to find the highest value in an array? - the highest code on funbrain

I have this table:

[INT] = (numbers 60, 30, 40, 80, 10, 20);

I like to write a number of Java statements to sort the numbers, then the largest number is higher in the array to a variable named.

How do I start it?

Array (number);
int smallest = numbers [0];
more int = [];

They do not know how to get there ...
Thank you.

4 comments:

Matchu said...

to only the largest value, simply by the first value is beginning to find the highest, through exploration to see whether something is higher.

so

int [] numbers = (60,30,40,80,10,20);

int largest = number [0];

for (int i = 1, i \\ \\ \\ \\ \\ \\ \\ \\ u0026lt; numbers.length i + +) (
... if (numbers [i]> largest) (
more ...... = Number [i];
...)
)


or what we do is for the index, which is the same, only instead of going for the highest, and instead she had put highestIndex more = [i], it would highestIndex = i;

And then, finally, is the highest value in the table only numbers [highestIndex].

And another thing you can do is a sort of table for any classification algorithm (a kind of bubble is slower, but easier, but it works well for small quantities of this type)

Is then, after ordering its parent company, the higher

Figures [numbers.length-1]

Bill said...

You must sort the bladder.
In other words, if your own computer program, otherwise can write import some packages.

FunSun said...

The first element is the number [0];
The last element is the number [numbers.length-1];

So, more = [numbers.length-1];

shec0002 said...

int largest = 0;
for (int i: numbers) (
if (i> largest) (
largest = i;
)

Post a Comment