Sorting array element using bubble sort