title: How to insert a space in a charArray in an exact position [Java]
body: <p>My problem is that I'm getting a <code>String</code> and I need to check if there is a space in the 4th position but starting from the end. If in this position there is not a space, I should insert it. </p>
  
  <p>For example:
  I get this String: TW12EF, need to get it like this: TW1 2EF</p>
  
  <p>First of all I get the 4 last characters in a char <code>array</code> because I also need to check if they are numbers or letters.</p>
  
  <p>With this method I check if there is a space:</p>
  
  <pre><code>public static boolean isSpace(){
      return String.valueOf(charArray[0]).matches("[ \\t\\n\\x0B\\f\\r]");
  }
  </code></pre>
  
  <p><code>charArray</code> contains the last 4 characters of the input <code>String</code></p>
  
  <p>If <code>charArray[0]</code> wouldn't be a space, I want to insert a space in the 2nd place (<code>charArray[1]</code>)</p>
  
  <p>If there is something that I can correct in the question to make it easier to understand, just let me know and I will try to make it better for next questions.</p>