Question: Create a bubble sort method, called bubbleSrt(). This method will sort the array passed to it as a parameter and will display the results of
Create a bubble sort method, called bubbleSrt(). This method will sort the array passed to it as a parameter and will display the results of every pass through the bubble sort. The results should show the bubble sort should sort the highest values appearing on the right first and then working on down towards the left.
The main() method is given below. Use this method as is, making no modifications to it.
public class BubbleSortAssignment {
public static void main(String[] args){
BubbleSort bsrt = new BubbleSort();
int maxSize = 16;
int [ ] arr = new int [maxSize];
for(int j=0; j { int n = (int)(java.lang.Math.random()*99); arr[j] = n; }for (int index = 0; index System.out.print(arr[index] + " "); System.out.println(" "); long start = System.nanoTime(); bsrt.bubbleSrt(arr); long end = System.nanoTime(); System.out.println(" The time required to do the sort was " + (end - start) + " nanoseconds"); } } The results should look like this picture: 
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
