@SuppressWarnings("unchecked")
    public static <T extends BaseStat> T[] decode(byte[] bodyBytes, Class<T> clazz, int fieldsTotalSize,
            String charset) {
        if (bodyBytes.length % fieldsTotalSize != 0) {
            throw new IllegalStateException("invalid bodyBytes.length, bodyBytes.length=" + bodyBytes.length);
        }
        int count = bodyBytes.length / fieldsTotalSize;
        T[] results = (T[]) Array.newInstance(clazz, count);
        int offset = 0;
        for (int i = 0; i < results.length; i++) {
            try {
                Constructor<T> constructor = clazz.getConstructor(String.class);
                results[i] = constructor.newInstance(charset);
                results[i].setFields(bodyBytes, offset);
                offset += fieldsTotalSize;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return results;
    }