If your array is Array[Array[Int]], you just need to use yourArray.sortBy(_(3)). 3 is your field index, which you want to order according to this column.
But, if your array is not Array[Array[Int]], you can't use sortBy directly. You'd better to use Sorting which is imported from scala.util.Sorting
Here is my code.
import scala.util.Sorting
Sorting.quickSort(yourArray)(new Ordering[Array[String]] {
def compare(x: Array[String], y: Array[String]) = {
x(3) compare y(3)
}
})
My array is Array[Array[String]], x(3) is one field which you want to compare. Of course, if you want to reverse sorting, you just need to use y(3) compare x(3) to replace x(3) compare y(3).
If your array is other type, you just need to use your type to replace Array[String]