code: static int trimSpaces(char[] chars, int len) {
  		// leading and trailing #x20's are removed
  		int newLen = len;
  
  		// leading
  		while (newLen > 0 && chars[0] == ' ') {
  			// eliminate one leading space
  			shiftLeft(chars, 0, newLen);
  			newLen--;
  		}
  		// trailing
  		int i = newLen - 1;
  		while (i >= 0 && chars[i] == ' ') {
  			// eliminate one trailing space
  			newLen--;
  			i--;
  		}
  
  		return newLen;
  	}
docs: returns new length