Write a Java program that identifies and print the third largest number from a given array.

Write a Java program that identifies and print the third largest number from a given array.
import java.util.Arrays;

public class demo {
    public static void main(String[] args) {
        int[] arr = {8, 6, 9, 2, 1, 66, 54};
        int arrLen = arr.length;

        // logic to sort the array in ascending order
        for(int i=0; i<arrLen-1; i++){
            for(int j=i+1; j<arrLen; j++){
                int temp = 0;
                if(arr[i]>arr[j]){
                    temp = arr[j];
                    arr[j] = arr[i];
                    arr[i] = temp;
                }
            }
        }
        /*
        // Logic to print the sorted array
        for (int a : arr){
            System.out.println(a);
        }
         */

        System.out.println("Third largest number in the array: " +arr[arrLen-3]);

    }
}

/*
Third largest number in the array: 9
*/