code: public static long parseDataRate(String dataRateValue) {
          int length = dataRateValue.length();
          if (length < 1) {
              throw new NumberFormatException("Illegal dataRate value, empty string not allowed");
          }
          char last = dataRateValue.charAt(length - 1);
          long multiplier = 1;
          String numberPart = dataRateValue;
          if (!Character.isDigit(last)) {
              for (int i = 0; i < PERMITTED_DATA_RATE_UNITS.length; i++) {
                  if (dataRateValue.endsWith(PERMITTED_DATA_RATE_UNITS[i])) {
                      multiplier = DATA_RATE_MULTIPLIERS[i];
                      int unitLength = PERMITTED_DATA_RATE_UNITS[i].length();
                      if (length < (unitLength + 1)) {
                          throw new NumberFormatException("Invalid dataRate value \"" + dataRateValue + "\", number part missing");
                      }
                      numberPart  = dataRateValue.substring(0, length - unitLength);
                      break;
                  }
              }
          }
          final long result = Long.parseLong(numberPart) * multiplier;
          if (result <= 0) {
              throw new NumberFormatException("Illegal dataRate value \"" + dataRateValue +
                      "\", must be a positive number or overflow occurred");
          }
          return result;
      }
docs: Converts a per second data rate specified in bytes (all digits), decimal kilobytes (digits followed by kB/s),
  binary kilobytes (digits followed by KiB/s), decimal megabytes (digits followed by MB/s), or
  binary megabytes (digits followed by KiB/s), values like 1048, 64kB/s, 10MiB/s.
  @param dataRateValue   data size
  @return - data rate converted to int number of bytes (implicitly per second)