public static long strToBytesCnt(String str) {
    if (str == null || str.isEmpty()) {
      return 0;
    }
    str = str.toLowerCase();
    if (!str.endsWith("b")) {
      str += "b";
    }
    long unit = 1;
    if (str.endsWith("kb")) {
      unit = IoTDBConstant.KB;
    } else if (str.endsWith("mb")) {
      unit = IoTDBConstant.MB;
    } else if (str.endsWith("gb")) {
      unit = IoTDBConstant.GB;
    }
    str = str.replaceAll("\\D", "");
    return Long.parseLong(str) * unit;
  }
Function for converting the byte count result to readable string.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java