Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static double computeDistance(ArrayList<Double> d1, ArrayList<Double> d2) { double squareSum = 0; for (int i = 0; i < d1.size() - 1; i++) { squareSum += (d1.get(i) - d2.get(i)) * (d1.get(i) - d2.get(i)); } return Math.sqrt(squareSum); } }