Sorting Java program

Write a sort method that uses the bubble- sort algorithm. The bub-ble- sort algorithm makes several passes through the array. On each pass, suc-cessive neighboring pairs are compared. If a pair is in decreasing order, its values are swapped; otherwise, the values remain unchanged. The technique is called a bubble sort or sinking sort because the smaller values gradually bub-ble their way to the top and the larger values sink to the bottom. Use 6.0, 4.4, 1.9, 2.9, 3.4, 2.9, 3.5 to test the method.

I have taken java, this is my second time around, but we never covered searching or sorting the first time I took it. So, I'm not very familar or understanding this concept well enough. So, I was wondering if someone could provide me even a similar program that I might be able to follow and understand from that would be very helpful. That way I will get an idea of how it works, something fairly simple. This assignment is due July 8th. Thank you in advance! :)

Sorry, for the delay in getting back to this thread, had final assignments to complete that it got hectic.

I have worked with moutanna in the past and he's always been able to help. I usually ask questions to understand what he's posted, so I learn that way...I guess learning backwards. But, I understand where you are coming from NormR1, don't worry I will learn this piece of program well before I go ahead and submit it this week.

I have taken java programming before, but this is the first time i'm having to do bubble sorting.
So, obviously this piece of program that moutanna has posted is just the method for sorting, I still need to write the main....correct? Because, when I complied and tried running it to test it, it didn't work.

As for the sorting it's just arrays, right? Could someone talk me through the steps of this method?

Assuming the code is going thru an array.
To compare to adjacent elements have two indexes that differ by one: i and i-1 or i and i+1
It the two elements are in the wrong order, swap them; move one to a temp, move other to the first and move temp to the last.

Ok lets do it step by step:
Given an array, for example: int[] intArray = new int[]{4,5,3,2,1,6};
Write a loop that prints out two elements or the array on every loop:
1st & 2nd; 2nd & 3rd; 3rd & 4th
until all elements have been printed in pairs.

um okay let me see if I'm understnding what you are trying to explain:

we have a list of the inputted numbers and a variable TEMP, right?
so say we have an array of 5
the 1st number in that list would be compared to the following number--the 2nd number
if the first number is greater than the following then it's NOT sorted, therefore
that 1st number is assigned to the TEMP variable to hold it. then the 2nd number is equal to the first number -- I guess the 2nd number is being put into the place of the first. Then, the 1st number which was in TEMP is assigned back to the 2nd's place.

I know that may have been hard to follow so I guess let me try to represent my understanding by variables

array:
a <--1
b <--2
c <--3
d <--4
e <--5

IF a > b
Sort = false
double TEMP = a = b
[i+1] = TEMP <-- a

They are swapped like that, right? Would you say that I have got the idea that you were trying to explain to me?

oOoo, I like that link that explained the lines of code that was really helpful to understand of why what was put where. Thank you.
And, yes yesterday I had figured out that I needed to add a main, so I went ahead and did that for the numbers I was given to test for, it works perfectly! Thank you so much for your help once again!