Find Highest and Lowest ASCII value Program in Java

Define a class to declare a character array of size ten, accept the characters into the array and display the characters with highest and lowest ASCII (American Standard Code for Information Interchange) value. [10]
EXAMPLE
INPUT
‘R’, ‘2’,’9′,’A’,’N’,’p’,’m’, ‘Q’,’F’
OUTPUT:
Character with highest ASCII value = z
Character with lowest ASCII value =A


import java.util.Scanner;

public class ValueOfASCII
{

    public static void main(String[] args)
    {
        char characters[] = new char[10];
        Scanner sc = new Scanner(System.in);
        int l = characters.length;
        System.out.println("Enter 10 characters:");
        for (int i = 0; i < l; i++)
        {
            characters[i] = sc.next().charAt(0);
        }
        int largestASCII = (int) characters[0];
        int smallestASCII = (int) characters[0];
        for (int i = 1; i < l; i++)
        {
            if ((int) characters[i] > largestASCII)
            {
                largestASCII = (int) characters[i];
            }
            if ((int) characters[i] < smallestASCII)
            {
                smallestASCII = (int) characters[i];
            }
        }

        System.out.println("Character with lowest ASCII value  :" + (char)smallestASCII);
        System.out.println("Character with highest ASCII value :" + (char)largestASCII);
    }

}


Output:

Enter 10 characters:
R
z
q
A
N
p
m
U
Q
F
Character with lowest ASCII value  :A
Character with highest ASCII value :z