Here you can find the source of normalizeTrimmedText(char[] ch)
private static char[] normalizeTrimmedText(char[] ch)
//package com.java2s; //License from project: Open Source License public class Main { private static char[] normalizeTrimmedText(char[] ch) { char[] ch2 = new char[ch.length]; boolean inWhitespace = false; int j = 0; for (int i = 0; i < ch.length; i++) { char c = ch[i]; boolean isWhitespace = Character.isWhitespace(c); if (isWhitespace && !inWhitespace) { ch2[j] = ' '; j++;/*from w ww . j av a2 s . com*/ inWhitespace = true; } else if (!isWhitespace) { ch2[j] = c; j++; inWhitespace = false; } } char[] ch3 = new char[j]; for (int i = 0; i < j; i++) { ch3[i] = ch2[i]; } return ch3; } }