Truncate excess length in a string - Java Quiz Question

Write a program to truncate the excess length in a string and put ellipsis (...) if the size is greater than 20. When truncated, the total length including ellipsis should be 20 characters.

Input Output
Hello Hello
Hello Merit Campus Hello Merit Campus
Hello, How are you doing today? Hello, How are yo...
This is a great day. This is a great day.
Sun rises in the east and sets in the west. Sun rises in the ...

class TruncateToTwentyCharacters
    public static void main(String s[])
        String input = "Hello, How are you doing today?";
        String result = truncateToTwentyCharacters(input);


    public static String truncateToTwentyCharacters(String input)