code: public static double[] normalizeL1(double[] vector) {
  		// compute vector 1-norm
  		double norm1 = 0;
  		for (int i = 0; i < vector.length; i++) {
  			norm1 += Math.abs(vector[i]);
  		}
  
  		if (norm1 == 0) {
  			Arrays.fill(vector, 1.0 / vector.length);
  		} else {
  			for (int i = 0; i < vector.length; i++) {
  				vector[i] = vector[i] / norm1;
  			}
  		}
  		return vector;
  	}
docs: This method applies L1 normalization on a given array of doubles. The passed vector is modified by the
  method.
  
  @param vector
  the original vector
  @return the L1 normalized vector