I'm getting 6 paris in that two are repeated help me?

public class App14_TargetSumTriplets {

static void targetSumTriplet(int[] arr, int target) {
	int low = 0;
	int high = arr.length - 1;
	int mid = (low + high) / 2;

	while (low < high) {

		if (arr[low] + arr[mid] + arr[high] == target) {
			System.out.println(arr[low] + " " + arr[mid] + " " + arr[high]);
			high--;
			mid++;
		} else if (arr[low] + arr[mid] + arr[high] > target) {
			mid--;
			high--;
		} else {
			high++;
		}

	}
}

public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();

	int[] arr = new int[N];

	for (int i = 0; i < arr.length; i++) {
		arr[i] = sc.nextInt();
	}
	int target = sc.nextInt();
	Arrays.sort(arr);
	targetSumTriplet(arr, target);
}

}

@nigamshubham1998,
Don’t use this approach. You will miss out on various triplets.

Also, follow the output format given in the question.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.