Inversions. Suppose that a music site wants to compare your song preferences to those of a friend. One approach is to have you and your friend each rank a set of n songs and count the number of pairs of songs (i, j) for which you prefer i to j but your friend prefers j to i. When the count is low, the preferences are similar.
More generally, given an array of integers, a pair of elements a[i] and a[j]are inverted if i < j and a[i] > a[j]. For example, the array a[] has 1 inversion and the array b[] has 4 inversions.
Write a program Inversions.java that implements the following API: