private static String replaseSpace(
      final String s) {

    int length = s.length();
    int spaceCount = 0;
    for (char c : s.toCharArray()) {
      if (c == ' ') {
        spaceCount++;
      }
    }

    int newLength = length + spaceCount * 2;

    char[] newString = new char[newLength];
    for (int i = s.length() - 1; i >= 0; i--) {
      if (s.charAt(i) == ' ') {
        newString[newLength - 1] = '0';
        newString[newLength - 2] = '2';
        newString[newLength - 3] = '%';
        newLength = newLength - 3;
      } else {
        newString[newLength - 1] = s.charAt(i);
        newLength = newLength - 1;
      }
    }
    return new String(newString);

  }