Java Programming - array - for int

I'm trying to create a program to print the maximum element (largest number) of an element stored in some array values.

I can't figure out the right for (int code. I need it to compare the maximum with the next element.

And also need to check if the next element is bigger then resest the max to that.

Here is what I have so far:

public class CalcMax

{

public static void main (String[] args)

{

double values[] = {1.3, 5.6, 2.9, 3.7, 2.5, 3.2};

double max = values[0];

for (int i =

max = Double.parseDouble(inString);

System.out.println("max value = " + max);

}

}

[665 byte] By [Kaisa] at [2007-11-26 23:12:08]
# 1

And what is the problem? The code you posted does not compile, so there must be some kind of compile error: post it here as well. If you used some other code, post it using code tags: http://forum.java.sun.com/help.jspa?sec=formatting so the [i] doesn't get eaten as an italic tag by the forum software (what just happened to you).

Thanks.

prometheuzza at 2007-7-10 14:09:42 > top of Java-index,Java Essentials,Java Programming...
# 2
I want to know what code to enter here:for (int i = I want the program to print the largest number out of the double values.
Kaisa at 2007-7-10 14:09:42 > top of Java-index,Java Essentials,Java Programming...
# 3
I want to know what code to enter here:for (int i = Here's how to use a for statement: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html
prometheuzza at 2007-7-10 14:09:42 > top of Java-index,Java Essentials,Java Programming...