int[]myArray={1,2,33,56,34,85,32};
//find maximum number in the array
int max=0;
for(int i=0;i<myArray.length;i++)
{
if (myArray[i]>max)
{
max=myArray[i];
}
}
System.out.println("maximum num in the array is = " + max);
//find second largest number in the array
int secondLargest = 0;
for(int i=0; i<myArray.length; i++) {
if(myArray[i] < max && myArray[i] > secondLargest) {
secondLargest = myArray[i];
}
}
System.out.println("The second Largest num in the array is = " + secondLargest);
//find third largest numbr in the array.
int thirdLargest = 0;
for(int i=0; i<myArray.length; i++) {
if(myArray[i]< secondLargest && myArray[i]> thirdLargest) {
thirdLargest = myArray[i];
}
}