3Sum Smaller


I have a question for the twoSumSmaller:
private int twoSumSmaller(int[] nums, int startIndex, int target) { int sum = 0; for (int i = startIndex; i < nums.length  1; i++) { int j = binarySearch(nums, i, target  nums[i]); sum += j  i; } return sum; }
Why we use binary search for target  nums[i] from index i, rather than i+1? I think we need to find the right most position after i, then it is
int j = binarySearch(nums, i+1, target  nums[i]);
, but the answer is wrong. Thx!

@anku There is no need to consider the duplicates of numbers , only index i, j, k are different is enough.