public int findAllTriplets(int input[], int total) {
        Arrays.sort(input);
        int result = 0;
        for (int i = 0; i < input.length - 2; i++) {
            int j = i + 1;
            int k = input.length - 1;

            while (j < k) {
                if (input[i] + input[j] + input[k] >= total) {
                    k--;
                } else {
                    result += k - j;
                    j++;
                }
            }
        }
        return result;
    }
Date 12/29/2015
@author Tushar Roy

Given array with unique numbers and a total,  find all triplets whose sum is less than total

http://www.geeksforgeeks.org/count-triplets-with-sum-smaller-that-a-given-value/
src/com/interview/array/TripletSumLessThanTotal.java