public static double loss(double pred,double y,double c){
  final double x=y - pred;
  if (Math.abs(x) <= c)   return x * x * 0.5;
 else   return c * (Math.abs(x) - c / 2);
}

public static double loss ( double pred , double y , double c ) { final double x = y - pred ; if ( Math . abs ( x ) <= c ) return x * x * 0.5 ; else return c * ( Math . abs ( x ) - c / 2 ) ; }
computes the huberloss loss
