code: public double getDistance(double[] sample1, double[] sample2) throws IllegalArgumentException {
  
  		int n = sample1.length;
  		if (n != sample2.length || n < 1)
  			throw new IllegalArgumentException("Input arrays must have the same length.");
  
  		double sumOfDifferences = 0;
  		for (int i = 0; i < n; i++) {
  			if (Double.isNaN(sample1[i]) || Double.isNaN(sample2[i]))
  				continue;
  
  			sumOfDifferences += Math.abs(sample1[i] - sample2[i]);
  		}
  
  		return sumOfDifferences;
  	}
docs: Get the distance between two data samples.
  
  @param sample1
  the first sample of <code>double</code> values
  @param sample2
  the second sample of <code>double</code> values
  @return the distance between <code>sample1</code> and
  <code>sample2</code>
  @throws IllegalArgumentException
  if the two samples contain different amounts of values