Bubble Sort using the template method pattern