euclidian Distance - Java java.lang

Java examples for java.lang:Math Trigonometric Function

Description

euclidian Distance

Demo Code


//package com.java2s;

public class Main {
    public static double euclidianDistance(double[] doubles1,
            double[] doubles2) {
        double result = 0;
        for (int i = 0; i < doubles1.length; i++) {
            result += Math.pow(doubles1[i] - doubles2[i], 2);
        }/*www .ja  v a2s .  c om*/
        return Math.sqrt(result);
    }
}

Related Tutorials