code: public static final double[] replaceValues(double[] v, double oldValue,	double newValue) {
  		double[] ret = new double[v.length];
  		for (int i = 0; i < v.length; i++) {
  			double vi = v[i];
  			if (Double.compare(oldValue, vi) != 0) {
  				// no substitution
  				ret[i] = vi;
  			} else {
  				ret[i] = newValue;
  			}
  		}
  		return ret;
  	}
docs: Return a new array with all the occurences of oldValue replaced by newValue.