Given an array, sort the array using Bubble Sort algorithm. Bubble sort is an in-place comparison sort. Bubble sort algorithm compares each pair of adjacent elements and swaps them if they are in the wrong order. The pass through the array is repeated until no swaps are needed, which indicates that the array is sorted. Java code is given in the code snippet section. Java visualization is provided in algorithm visualization section.