public static <T> T instantiateClassWithParameters(Class<T> clazz,
			Class<?>[] paramsTypes, Object[] paramValues)

	{

		try
		{
			if (paramsTypes != null && paramValues != null)
			{
				if (!(paramsTypes.length == paramValues.length))
				{
					throw new IllegalArgumentException(
							"Number of types and values must be equal");
				}

				if (paramsTypes.length == 0 && paramValues.length == 0)
				{
					return clazz.newInstance();
				}
				Constructor<T> clazzConstructor = clazz
						.getConstructor(paramsTypes);
				return clazzConstructor.newInstance(paramValues);
			}
			return clazz.newInstance();

		} catch (Exception e)
		{
			throw new RuntimeException("error instance response class");
		}

	}