count array data less than number being compared to

I have an array with specified data int[] nums = {5,2,1,4,3};

what I need to do is take the smaller slot i. e. 0 < 4 and count the values in the slots bigger (0 < 1 & 2 & 3 & 4) that have a greater value than the value of the number in the smaller slot. since 5 is greater than 2,1,4,3 the count will be 4 for that comparison and for slot 2 the count will be 1 since the only number after slot 1/nums[1] that is smaller than 2 is 1 and so on.

Here is what I have so far:

Code:

` public void CountOutOfOrderPairs(int[] nums) { //return int`

nums = {5,2,1,4,3};

int i, j = nums[4], count = 0;

for (i = 0; i < nums.length; i++) {

if (nums[i] > j)

count++;

System.out.println(count + "after count");

}

}

Re: count array data less than number being compared to

Ok, and what is your question?