Here you can find the source of distance(double x1, double y1, double z1, double x2, double y2, double z2)
public static double distance(double x1, double y1, double z1, double x2, double y2, double z2)
//package com.java2s; //License from project: LGPL public class Main { public static double distance(double x1, double y1, double z1, double x2, double y2, double z2) { return Math.pow(Math.pow((x2 - x1), 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2), 0.5); }/*from ww w . ja v a 2 s . c o m*/ }