not able to think how to get these ans in incrreasing order, do check my code first then tell me what to do.
arraytargetSumTriplet
You are able to correctly print the order of each triplet, but all the answers are not sorted among themselves. For doing that, all you need to do, is pass a sorted array to your function. That is, after taking input of your array, apply Arrays.sort(arr) and then pass this sorted array to your function. This will automatically ensure that all your answers are sorted among themselves.
Also, for each triplet also you can keep a temporary array of size 3 and add all elements to it and then sort it and print, instead of putting so many if-else conditions.
I hope this clears your doubt, if there’s anything you didn’t understand then let me know!
You have removed the if-else loops, but you have not sorted the triplet elements among themselves. Note that in this question, the answers are sorted twice/in two ways - 1) All the different possible triplets are sorted and 2) All elements of a particular triplet are sorted among themselves.
You need to ensure that both these are covered by your code. Also, it is always better to use the in-built sort function in such questions because its time complexity is better than bubble sort. I have made the required changes to your code to help you understand better, let me know if anything is unclear!