public static String[] tokenizeToStringArray(String str, String delimiters, boolean trimTokens,
            boolean ignoreEmptyTokens) {
        
        if (str == null) {
            return EMPTY_STRING_ARRAY;
        }
        
        StringTokenizer st = new StringTokenizer(str, delimiters);
        List<String> tokens = new ArrayList<>();
        while (st.hasMoreTokens()) {
            String token = st.nextToken();
            if (trimTokens) {
                token = token.trim();
            }
            if (!ignoreEmptyTokens || token.length() > 0) {
                tokens.add(token);
            }
        }
        return toStringArray(tokens);
    }
@Test
    void testTokenizeToStringArray() {
        // Test case 1: Empty string
        String str1 = "";
        String delimiters1 = ",";
        boolean trimTokens1 = true;
        boolean ignoreEmptyTokens1 = false;
        String[] expected1 = new String[0];
        String[] result1 = StringUtils.tokenizeToStringArray(str1, delimiters1, trimTokens1, ignoreEmptyTokens1);
        assertArrayEquals(expected1, result1);
        
        // Test case 2: Null string
        String str2 = null;
        String delimiters2 = " ";
        boolean trimTokens2 = false;
        boolean ignoreEmptyTokens2 = true;
        String[] expected2 = new String[0];
        String[] result2 = StringUtils.tokenizeToStringArray(str2, delimiters2, trimTokens2, ignoreEmptyTokens2);
        assertArrayEquals(expected2, result2);
        
        // Test case 3: Single token
        String str3 = "Hello";
        String delimiters3 = ",";
        boolean trimTokens3 = true;
        boolean ignoreEmptyTokens3 = false;
        String[] expected3 = {"Hello"};
        String[] result3 = StringUtils.tokenizeToStringArray(str3, delimiters3, trimTokens3, ignoreEmptyTokens3);
        assertArrayEquals(expected3, result3);
        
        // Test case 4: Multiple tokens with trimming
        String str4 = "  Hello,  World,  ";
        String delimiters4 = ",";
        boolean trimTokens4 = true;
        boolean ignoreEmptyTokens4 = false;
        String[] expected4 = {"Hello", "World", ""};
        String[] result4 = StringUtils.tokenizeToStringArray(str4, delimiters4, trimTokens4, ignoreEmptyTokens4);
        assertArrayEquals(expected4, result4);
        
        // Test case 5: Multiple tokens with empty tokens ignored
        String str5 = "  ,Hello,  ,World,  ";
        String delimiters5 = ",";
        boolean trimTokens5 = true;
        boolean ignoreEmptyTokens5 = true;
        String[] expected5 = {"Hello", "World"};
        String[] result5 = StringUtils.tokenizeToStringArray(str5, delimiters5, trimTokens5, ignoreEmptyTokens5);
        assertArrayEquals(expected5, result5);
    }