Bubble Sort Descending
import java.util.*; //Importing Packages
import java.io.*;
import java.lang.*;
public class Bubble_Sort_2 //declaring class
{ //opening braces of class
public static void main(String args[]) //declaring main method
{ //opening braces of main method
Scanner pa = new Scanner(System.in); //declaring Scanner class
System.out.println("Enter the size of the array");
int n = pa.nextInt(); //To Store the size of an Array
int a[] = new int [n]; //declaring an array of size n
int t=0; //temporary variable
System.out.println("Enter Number");
for(int i=0;i<n;i++) //Loop to input values in the Array
a[i] = pa.nextInt(); //To input values
System.out.println("ORIGINAL ARRAY");
for(int i=0;i<n;i++) //Loop to Print Array in Single Line
System.out.print(a[i]+"\t");
for(int i=0;i<n;i++) //Outer Loop of Bubble Sorting
for(int j=0;j<n-1;j++) //Inner Loop of Bubble Sorting
if(a[j] < a[j+1]) //To check if the value ahead is Bigger or not
t = a[j]; //To Inter-Change Values
a[j] = a[j+1];
a[j+1] = t;
System.out.println("\n"+"SORTED ARRAY");
for(int i=0;i<n;i++) //Loop to Print Sorted Array
System.out.print(a[i]+"\t");
} //closing braces of main method
} //closing braces of class
VARIABLE DATA TYPE FUNCTION
n Integer To Store the Size of an Array
a Integer To Store the Array
i Integer Used as a Local variable
t Integer Used to Transfer values
j Integer Used For the Bubble Sorting