Largest in Array Program in Java

import java.util.*;

public class LargestInArray
{
    public static void main(String[] args)
    {
        int ar[] = new int[10];
        int l;
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 10; i++)
        {
            System.out.print("Enter the number ar[" + i + "]:");
            ar[i] = sc.nextInt();
        }
        l = ar[0];
        for (int i = 9; i > 0; i--)
        {
            if (ar[i] > l)
            {
                l = ar[i];
            }
        }
        System.out.println("Largest=" + l);
    }
}


Output:

Enter the number ar[0]:4
Enter the number ar[1]:6
Enter the number ar[2]:15
Enter the number ar[3]:24
Enter the number ar[4]:57
Enter the number ar[5]:86
Enter the number ar[6]:45
Enter the number ar[7]:31
Enter the number ar[8]:32
Enter the number ar[9]:18
Largest=86
java java tutorials learn java study java