public static BigDecimal toBigDecimal(String str) {
        if (str == null || str.isEmpty() || "null".equals(str)) {
            return null;
        }

        if (JDKUtils.STRING_CODER != null) {
            int code = JDKUtils.STRING_CODER.applyAsInt(str);
            if (code == JDKUtils.LATIN1 && JDKUtils.STRING_VALUE != null) {
                byte[] bytes = JDKUtils.STRING_VALUE.apply(str);
                return parseBigDecimal(bytes, 0, bytes.length);
            }
        }

        char[] chars = JDKUtils.getCharArray(str);
        return parseBigDecimal(chars, 0, chars.length);
    }
All the positive powers of 10 that can be
represented exactly in double/float.
core/src/main/java/com/alibaba/fastjson2/util/TypeUtils.java