public static double quantile(double val,double mu,double sigma,double k){
  if (val < 0.0 || val > 1.0) {
    return Double.NaN;
  }
  if (k < 0) {
    return mu + sigma * Math.max((1. - Math.pow(-Math.log(val),k)) / k,1. / k);
  }
 else   if (k > 0) {
    return mu + sigma * Math.min((1. - Math.pow(-Math.log(val),k)) / k,1. / k);
  }
 else {
    return mu + sigma * Math.log(1. / Math.log(1. / val));
  }
}

public static double quantile ( double val , double mu , double sigma , double k ) { if ( val < 0.0 || val > 1.0 ) { return Double . NaN ; } if ( k < 0 ) { return mu + sigma * Math . max ( ( 1. - Math . pow ( - Math . log ( val ) , k ) ) / k , 1. / k ) ; } else if ( k > 0 ) { return mu + sigma * Math . min ( ( 1. - Math . pow ( - Math . log ( val ) , k ) ) / k , 1. / k ) ; } else { return mu + sigma * Math . log ( 1. / Math . log ( 1. / val ) ) ; } }
quantile function of gev distribution
