import java.util.Arrays; /** * Write a description of class Bubbles here. * * @author (your name) * @version (a version number or a date) */ public class Bubbles { // instance variables - replace the example below with your own private int x; /** * Constructor for objects of class Bubbles */ public Bubbles() { // initialise instance variables x = 0; } /** * An example of a method - replace this comment with your own * * @param y a sample parameter for a method * @return the sum of x and y */ public int[] bubbleSort(int[] a) { System.out.println("0 : " +Arrays.toString(a)); boolean flag = true; while (flag == true) { flag=false; for (int i = 0; i < a.length-1; i++) { if (a[i] > a[i+1]) { flag = true; int temp = a[i]; a[i] = a[i+1]; a[i+1] = temp; } } System.out.println(" : " + Arrays.toString(a)); } System.out.println("end " + Arrays.toString(a)); return a; } }