It looks through an array of five objects. Each time, if the object it's looking at is bigger than the next one along, it swaps those two round in the array.
It repeats this over and over until it didn't find any to swap when it went through the array. This is the sorting operation known as bubble sort.
Your code supposedly sorts the values in array R.
The variable "swapped" is used to keep track of the status of the sorting.
Swapped is set to false at the start of every do/while iteration, and set only to true when a modification was made to the array order.
When no modification was made, the value of swapped remains false and the condition while(swapped == true) evaluates to false, therefore ending the loop.