code: public static MemorySize parse(String value, MemoryUnit defaultUnit) {
          if (value == null || value.length() == 0) {
              return new MemorySize(0, MemoryUnit.BYTES);
          }
  
          MemoryUnit unit = defaultUnit;
          final char last = value.charAt(value.length() - 1);
          if (!Character.isDigit(last)) {
              value = value.substring(0, value.length() - 1);
              switch (last) {
                  case 'g':
                  case 'G':
                      unit = MemoryUnit.GIGABYTES;
                      break;
  
                  case 'm':
                  case 'M':
                      unit = MemoryUnit.MEGABYTES;
                      break;
  
                  case 'k':
                  case 'K':
                      unit = MemoryUnit.KILOBYTES;
                      break;
  
                  default:
                      throw new IllegalArgumentException("Could not determine memory unit of " + value + last);
              }
          }
  
          return new MemorySize(Long.parseLong(value), unit);
      }
docs: Parses string representation of a memory size value.
  Value may end with one of suffixes;
  <ul>
  <li>'k' or 'K' for 'kilo',</li>
  <li>'m' or 'M' for 'mega',</li>
  <li>'g' or 'G' for 'giga'.</li>
  </ul>
  <p/>
  Uses default unit if value does not contain unit information.
  <p/>
  Examples:
  12345, 12345m, 12345K, 123456G