{0.2,0.5,0.6,0.7,0.8,0.9}
});
//Following is the variance surface where variance = f(strike,maturity) and f = function
final BlackVarianceTermStructure varianceSurface = new BlackVarianceSurface(
today, datesAxis,
strikeAxis, volatilityMatrix, new Actual365Fixed(),
Extrapolation.InterpolatorDefaultExtrapolation,
Extrapolation.InterpolatorDefaultExtrapolation);
((BlackVarianceSurface)varianceSurface).setInterpolation(null);
//As the surface has been set up to do interpolations so let's start calculating the volatilities for strikes
//and maturities lying between the points as mentioned by strikesAxis and dateAxis.
//Calculating blackVolatility using maturity as 12 days after today and strike as 18
volatility1 = varianceSurface.blackVol(date12.clone(), 18);
System.out.println("Interpolated BlackVolatility on BlackVarianceSurface = "+volatility1);
//Calculating blackVolatility using maturity as 22 days after today and strike as 33
volatility2 = varianceSurface.blackVol(date22.clone(), 33);
System.out.println("Interpolated BlackVolatility on BlackVarianceSurface = "+volatility2);
//Calculating blackVolatility using maturity as 32 days after today and strike as 45
volatility3 = varianceSurface.blackVol(date32.clone(), 45);
System.out.println("Interpolated BlackVolatility on BlackVarianceSurface = "+volatility3);
//Calculating blackForwardVolatility between 12 days after today and 16 days after today with strike as 20
forwardVolatility1 = varianceSurface.blackForwardVol(date12.clone(), date16.clone(), 20, true);
System.out.println("Interpolated BlackForwardVolatility on BlackVarianceSurface = "+forwardVolatility1);
//Calculating blackForwardVolatility between 22 days after today and 26 days after today with strike as 40
forwardVolatility2 = varianceSurface.blackForwardVol(date22.clone(), date26.clone(), 40, true);
System.out.println("Interpolated BlackForwardVolatility on BlackVarianceSurface = "+forwardVolatility2);
//Calculating blackForwardVolatility between 27 days after today and 35 days after today with strike as 50
forwardVolatility3 = varianceSurface.blackForwardVol(date27.clone(), date35.clone(), 50, true);
System.out.println("Interpolated BlackForwardVolatility on BlackVarianceSurface = "+forwardVolatility3);
//Calculating blackVariance using maturity as 12 days after today and strike as 20
System.out.println("Interpolated BlackVariance on BlackVarianceSurface = "+varianceSurface.blackVariance(date12.clone(), 20));
//Calculating blackForwardVariance between 12 days after today and 16 days after today with strike as 20
System.out.println("Interpolated BlackForwardVariance on BlackVarianceSurface = "+varianceSurface.blackForwardVariance(date12.clone(), date16.clone(), 20, true));
System.out.println("//================================ImpliedVolTermStructure=============================");
//As mentioned in the java docs the implied volatility termstructure remains linked to
//the underlying termstructure and changes to same are linked to ImpliedVolTermStructure