There are a lot of different sorting algorithms out there. Some of the differences include:

1) ease of implementation

2) whether it sorts in place or must make a 2nd copy to sort into

3) best case speed

4) worst case speed

Quick sort is generally considered the fastest and is an nlogn best case, but n^2 worst case (depending on choice of pivot, a presorted array gives n^2). It also sorts in place. It is the most often used sorting algorithm. It chooses a random element in an array called the pivot, then divides the array into stuff bigger than the pivot and stuff smaller than the pivot. This is repeated recursively.

Merge sort is always nlogn, best and worst case, BUT it doesn't sort in place so requires a lot of copying. It's easier to implement than quick sort, and pretty fast. It just divides the array into 2 arrays, sorts those, and then merges them back together, with each smaller array being sorted through recursive calls to merge sort. The sorting coefficient is higher than for quick sort, which is why it's generally a slower algorithm, although it is faster for large pre sorted arrays if you don't randomize the pivot in quicksort (when qsort becomes n^2).

Bubble sort is probably the easiest to implement algorithm. All you have to do is go through an array, and compare adjacent elements. If they are out of order, you swap them. Repeat until no changes are made to the array. Elements sort of "percolate" to their spots. This is an n^2 best/worst case sort algorithm, but sorts in place. I would personally use this algorithm if efficiency/speed was not necessary (for example, sorting small arrays where speed is a non-issue).

Selection sort is another easy algorithm, but does not sort in place. Basically, you look through the array and find the smallest element, and put it in position 1 in the new array. Then you get the 2nd smallest, etc. This is n^2 and does not sort in place. Easy to implement though.

Some others that I remember studying but don't remember in detail are shell sort and heap sort, both nlogn iirc, and insertion sort, which is n^2. There are also some n^1 sorting algorithms that work in special cases, like radix sort, where you know some stuff in advance about the data. Not usually useful.

C includes an implementation of qsort that works on any type of array. It is implemented with function pointers and requires that you define the functions that actually do comparisons (ie. when is a greater than b, less than b, and equal to b). You then pass this function as an argument to the qsort generic function.

I would imagine java has some form of a sort algorithm pre-implemented.