code: final static public char[] trim(char[] chars)
  	{
  
  		if (chars == null)
  		{
  			return null;
  		}
  
  		int start = 0, length = chars.length, end = length - 1;
  		while (start < length && chars[start] == ' ')
  		{
  			start++;
  		}
  		while (end > start && chars[end] == ' ')
  		{
  			end--;
  		}
  		if (start != 0 || end != length - 1)
  		{
  			return subarray(chars, start, end + 1);
  		}
  		return chars;
  	}
docs: Answers a new array removing leading and trailing spaces (' '). Answers the given array if there is no space
  characters to remove. <br>
  <br>
  For example:
  <ol>
  <li>
  
  <pre>
  chars = { ' ', 'a' , 'b', ' ',  ' ' }
  result =&gt; { 'a' , 'b' }
  </pre>
  
  </li>
  <li>
  
  <pre>
  array = { 'A', 'b' }
  result =&gt; { 'A' , 'b' }
  </pre>
  
  </li>
  </ol>
  
  @param chars
  the given array
  @return a new array removing leading and trailing spaces (' ')