private static double distanceSq(Color a,Color b){
  double rMean=(a.getRed() + b.getRed()) / 256.0 / 2.0;
  double dr=(a.getRed() - b.getRed()) / 256.0;
  double dg=(a.getGreen() - b.getGreen()) / 256.0;
  double db=(a.getBlue() - b.getBlue()) / 256.0;
  double d=(2.0 + rMean) * dr * dr + 4.0 * dg * dg + (2.0 + 1.0 - rMean) * db * db;
  return d / 9.0;
}

private static double distanceSq ( Color a , Color b ) { double rMean = ( a . getRed ( ) + b . getRed ( ) ) / 256.0 / 2.0 ; double dr = ( a . getRed ( ) - b . getRed ( ) ) / 256.0 ; double dg = ( a . getGreen ( ) - b . getGreen ( ) ) / 256.0 ; double db = ( a . getBlue ( ) - b . getBlue ( ) ) / 256.0 ; double d = ( 2.0 + rMean ) * dr * dr + 4.0 * dg * dg + ( 2.0 + 1.0 - rMean ) * db * db ; return d / 9.0 ; }
calculates the square of the distance between the two specified colors .
