strTestIn = strTestIn.replaceAll("^\\s+", "");
removes whitespace at the start of the string.
strTestIn = strTestIn.replaceAll("\\s+$", "");
removes whitespace at the end of the string.
strTestIn = strTestIn.replaceAll("[ ]+", " ");
condenses multiple spaces into a single space.
strTestIn =strTestIn.replaceAll("(\\r\\n)+", "\r\n");
removes empty lines by replacing adjacent newlines with a single newline.
strTestIn = strTestIn.replaceAll("(\\t)+", " ");
condenses tabs into a single space.
So they all do different things. A combination is possible for those that have the same replacement string:
strTestIn = strTestIn.replaceAll("^\\s+|\\s+$", "");
strTestIn = strTestIn.replaceAll(" {2,}|\t+", " ");
strTestIn = strTestIn.replaceAll("(\r\n)+", "\r\n");
You can also clean up and improve the regexes a bit (removing some unnecessary backslashes, and changing the minimum number of spaces to two).