Bubble Sort is sorting technique. In the above example, the array is used to sort in ascending order and for descending order the ">" symbol has to be replaced by "<" symbol.
Binary Search requires sorted Array. To sort the given array, in-build sorting function "Arrays.sort()" has been used. Or sorting techniques such as Selection sort or Bubble sort can be used.