Here you can find the source of squareDistance(double x1, double y1, double x2, double y2)
public static double squareDistance(double x1, double y1, double x2, double y2)
//package com.java2s; public class Main { /**//from www .j a va 2 s.com * Computes the distance between two points squared. */ public static double squareDistance(double x1, double y1, double x2, double y2) { double xDiff = x1 - x2; double yDiff = y1 - y2; return xDiff * xDiff + yDiff * yDiff; } }