Programming Code Center(PCC)
[JAVA]

(PCC)::[How-to-write-Java-Program-to-Find-Largest-Element-of-an-Array]::[java]

File Name : LargestNew.java

//Example: Find largest element in an array
public class LargestNew {

    public static void main(String[] args) {
        double[] numArray = { 23.4, -34.5, 50.0, 33.5, 55.5, 43.7, 5.7, -66.5 };
        double largest = numArray[0];

        for (double num: numArray) {
            if(largest < num)
                largest = num;
        }

        System.out.format("Largest element = %.2f", largest);
    }
}

Output :

LargestNew.jpg