public static final char[] remove(char[] array, char toBeRemoved) {

	if (array == null) return null;
	int length = array.length;
	if (length == 0) return array;
	char[] result = null;
	int count = 0;
	for (int i = 0; i < length; i++) {
		char c = array[i];
		if (c == toBeRemoved) {
			if (result == null) {
				result = new char[length];
				System.arraycopy(array, 0, result, 0, i);
				count = i;
			}
		} else if (result != null) {
			result[count++] = c;
		}
	}
	if (result == null) return array;
	System.arraycopy(result, 0, result = new char[count], 0, count);
	return result;
}