@Override
	public void setProbabilities(Double[] probabilities) throws NGramException {

		/*
		 * int count = 0;// count the index of string[] probabilities if
		 * (probabilities == null) { throw new
		 * NGramException("ERROR: probabilities null or contains!"); } for
		 * (Double i : probabilities) { if ((i == null) || (i > 1) || (i <= 0))
		 * { throw new NGramException(
		 * "ERROR: probabilities contain at least one entry " +
		 * "which is null , zero, negative or greater than 1.0"); } }
		 * 
		 * count = probabilities.length; for (Double d : probabilities) {
		 * this.probabilities[count] = d; count++; }
		 */
		// new version use the checkArray check probabilities,and use list store
		// the probabilities
		if (checkArray(probabilities) == false) {
			throw new NGramException(
					"ERROR: probabilities is null or contains at least one entry which is null , zero, negative or greater than 1.0");
		}

		probabilitiesList.clear();
		for (double d : probabilities) {
			probabilitiesList.add(d);
		}
	}