Small Fact not working

It’s working in Eclipse but online judge says Wrong answer

import java.io.*;

class whileTest{ 
public static void main(String args[]) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int tc = Integer.parseInt(br.readLine());
	while(tc--!=0){
		int factOf = Integer.parseInt(br.readLine());
		calculate(factOf);
	}
}

public static void calculate(int factOf){                          // number to find fact of
	int[] array = new int[200];                                                   // array of length 200
	int m,
	temp=0;
	if(String.valueOf(factOf).length()==1){
		array[0]    = factOf; 														  // array[0] = 5
		m           = 1;													          // m = 1
	}else{
		int i        = 0;
		int tempFact = factOf; 
		while(tempFact!=0){
			array[i] = tempFact%10;
			tempFact/=10;
			i++;
		} 
		m       = 2;
	}
	
	for(int i=1;i<factOf;i++){
		for(int j=0;j<m;j++){
			int x 	 = array[j]*i+temp;                                    		  // 5*1+0=5 
			array[j] = x % 10;                                                     // 5%10=5
		    temp     = x/10;                                                       //5/10=0
		}
		while(temp>0){
			int y    = temp % 10;                                                     // 1%10=1
			array[m] = y;                                                             //array[1]=1
			temp     = temp/10;                                                       //1/10=0
			++m; 
			//System.out.println(m);
		}
	}
	
	int len = m-1;
	for(int i=0;i<m;i++){
			System.out.print(array[len--]); 
	}
}

}

Sorry, I realized the mistake I made :slight_smile: