public static String replaceWhitespaces(String str) {
		if (str == null) {
			throw new IllegalArgumentException("str cannot be null");
		}
		char[] strChars = str.toCharArray();
		int whitespaceCharsAmount = countWhitespaces(strChars);
		if (whitespaceCharsAmount == 0) {
			return str;
		}
		char[] strCharsWithReplacedWhitespaces = new char[strChars.length
				- whitespaceCharsAmount + whitespaceCharsAmount * 3];
		for (int i = 0, j = 0; i < strChars.length; i++, j++) {
			if (strChars[i] == WHITESPACE) {
				strCharsWithReplacedWhitespaces[j++] = '%';
				strCharsWithReplacedWhitespaces[j++] = '2';
				strCharsWithReplacedWhitespaces[j] = '0';
			} else {
				strCharsWithReplacedWhitespaces[j] = strChars[i];
			}
		}
		return new String(strCharsWithReplacedWhitespaces);
	}