data := []byte{76, 76, 2, 3, 12, 77, 4, 7, 1, 6}
length := len(data)
i := 0
j := 0
for i < length {
if data[j] < data[j+1] {
data[j], data[j+1] = data[j+1], data[j]
}
if length-i-2 == 0 {
break
} else if j == length-i-2 {
i++
j = 0
continue
} else {
j++
}
}
有疑问加站长微信联系(非本文作者)