### Question:
CountInversion { public int solve(int[] arr) { Integer[] convert = new Integer[arr.length]; for (int i = 0; i < arr.length; i++) { convert[i] = arr[i]; } return mergeSorter.template(convert,0,arr.length - 1, 0, new CountInversionMerger(), new SumResultAggr()); }  int solve(int[] arr);  }### Answer:
@Test public void basicTest1() { int[] arr = {3, 2, 1}; Assert.assertEquals(3, countInversion.solve(arr)); }
@Test public void basicTest2() { int[] arr = {1, 2, 3}; Assert.assertEquals(0, countInversion.solve(arr)); }
@Test public void basicTest3() { int[] arr = {1, 3, 2, 3, 1}; Assert.assertEquals(4, countInversion.solve(arr)); }
@Test public void randomTest() { Random r = new Random(); for (int j = 1; j <= 10; j++) { int N = 3000 * j; int[] arr = new int[N]; for (int i = 0; i < arr.length; i++) arr[i] = ((-N / 2) + r.nextInt(N)) / (j * j * j); int expect = reversePairs(arr); Assert.assertEquals(expect, countInversion.solve(arr)); } }