Write a function to compute the factorial of a number in java

The following is an acceptable solution.


public class factorial
{

	private int _computeFactorial(int num)
	{
		if(num > 0)
			return num * computeFactorial(num - 1);
		else
			return 1;
	}

	public int computeFactorial(int num) throws IllegalArgumentException
	{
		if(num < 0)
			throw new IllegalArgumentException("Factorial cannot be computer for negative numbers");
		else
			return _computeFactorial(num);
	}

	

	public static void main(String a[])
	{
		System.out.println("Computing factorial for "+a[0]);
		int num = 0;
		factorial f = new factorial();
		try{ 

			num = Integer.parseInt(a[0]);
		}catch(Exception e){
			System.out.println("Invalid Argument");
		}
		System.out.println("Factorial is "+f.computeFactorial(num));
	}

	
}