public static String cut(String str, int threshold) {
        if (isEmpty(str) || str.length() <= threshold) {
            return str;
        }
        return str.substring(0, threshold);
    }
@Test
    public void testCut() {
        String str = "aaaaaaabswbswbbsbwbsbbwbsbwbsbwbbsbbebewewewewewewewewewewew";
        String shortStr = "ab";
        assertEquals(10, StringUtil.cut(str, 10).length());
        assertEquals(2, StringUtil.cut(shortStr, 10).length());
    }