public static double safeSqrt(double x){
  return (x < 0 ? -Math.sqrt(-x) : Math.sqrt(x));
}

public static double safeSqrt ( double x ) { return ( x < 0 ? - Math . sqrt ( - x ) : Math . sqrt ( x ) ) ; }
the " safe " square root of the input value , handling negative values by simply making them positive and then negating the return value .
