private static <K> void printTable(List<K> list, int[] columnWidth) {
        Field[] fields = list.get(0).getClass().getDeclaredFields();
        printLine(columnWidth, fields.length);
        System.out.print(vertical);

        String format = "%s" + vertical;
        for (int i = 0; i < fields.length; i++) {
            System.out.printf(format, StringUtils.center(fields[i].getName(), columnWidth[i]));
        }
        System.out.println();
        printLine(columnWidth, fields.length);

        list.forEach(item -> {
            for (int i = 0; i < fields.length; i++) {
                fields[i].setAccessible(true);
                try {
                    System.out.print(vertical);
                    Object obj = fields[i].get(item);
                    if (obj != null) {
                        int charNum = getSpecialCharNum(obj.toString());
                        if (fields[i].getType().equals(Date.class)) {
                            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            String date = dateFormat.format(obj);
                            System.out.printf("%s", StringUtils.center(date, columnWidth[i]));
                        } else if (charNum > 0) {
                            System.out.printf("%s", StringUtils.center(obj.toString(), columnWidth[i] - charNum));
                        } else {
                            System.out.printf("%s", StringUtils.center(obj.toString(), columnWidth[i]));
                        }
                    } else {
                        System.out.printf("%s", StringUtils.center("NULL", columnWidth[i]));
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(vertical);
        });
        printLine(columnWidth, fields.length);
    }
Prints the given list to the console with the specified width.
inlong-manager/manager-client-tools/src/main/java/org/apache/inlong/manager/client/cli/util/PrintUtils.java