public static boolean hasUnit(String text) {
      checkArgument(text != null, "text can't be null");

      final String trimmed = text.trim();
      checkArgument(!trimmed.isEmpty(), "argument is an empty- or whitespace-only string");

      final int len = trimmed.length();
      int pos = 0;

      char current;
      while (pos < len && (current = trimmed.charAt(pos)) >= '0' && current <= '9') {
        pos++;
      }

      final String unit = trimmed.substring(pos).trim().toLowerCase(Locale.US);

      return unit.length() > 0;
    }
Enum which defines memory unit, mostly used to parse value from configuration file.

<p>To make larger values more compact, the common size suffixes are supported:

<ul>
  <li>1b or 1bytes (bytes)
  <li>1k or 1kb or 1kibibytes (interpreted as kibibytes = 1024 bytes)
  <li>1m or 1mb or 1mebibytes (interpreted as mebibytes = 1024 kibibytes)
  <li>1g or 1gb or 1gibibytes (interpreted as gibibytes = 1024 mebibytes)
  <li>1t or 1tb or 1tebibytes (interpreted as tebibytes = 1024 gibibytes)
</ul>
amoro-common/src/main/java/org/apache/amoro/utils/MemorySize.java