public static Triplet findThreeAddends(final int[] array, final int targetSum) {
        if (array == null || array.length < 3) {
            throw new IllegalArgumentException("Input array cannot be null and must contain at least 3 integers.");
        }

        final int[] copy = Arrays.copyOf(array, array.length);
        Arrays.sort(copy);

        for (int lowerBound = 0; lowerBound < copy.length - 2; lowerBound++) {
            final int lowest = copy[lowerBound];

            if (isOverflowSum(targetSum, -lowest)) {
                throwException(log);
            }
            final int localTargetSum = targetSum - lowest;

            int upperBound = copy.length - 1;
            int middleIndex = lowerBound + 1;

            while (middleIndex < upperBound) {
                final int middle = copy[middleIndex];
                final int highest = copy[upperBound];

                if (isOverflowSum(middle, highest)) {
                    throwException(log);
                }

                final int localSum = middle + highest;
                if (localSum < localTargetSum) {
                    middleIndex++;
                } else if (localSum > localTargetSum) {
                    upperBound--;
                } else {
                    return new Triplet(lowest, middle, highest, targetSum);
                }
            }
        }

        return null;
    }