Compile error?

I was trying to solve a problem but I was stuck because i am getting a compile error.
This is my error message: error: incompatible types: possible lossy conversion from long to int
div*=factorial[count];
I am confused because I am using long for both the variables, can i not multiply long with long?
This is my code:

/* Author- Yaswanth*/

import java.util.*;
import java.lang.*;
import java.io.*;


class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    
	    Scanner in=new Scanner(System.in);
		int t=in.nextInt();
		long factorial[]=new long[501],div=1;
		factorial[0]=1;
		for(int i=1;i<=500;i++){
		factorial[i]=i*factorial[i-1];
		factorial[i]%=1000000007;
		}
		
		while(t-->0)
		{
		    div=1;
		  String st=in.next();
		  int n=st.length();
		  int characters[]=new int[n];
		  for(int i=0;i<n;i++){
		      characters[i]=(int)st.charAt(i);
		  }
		  Arrays.sort(characters);
		  
		  long ans,count=1;
		  ans=factorial[n];
		  for(int i=0;i<n-1;i++){
		      if(characters[i]==characters[i+1]){
		          count++;
		          continue;
		      }
		      else if(characters[i]!=characters[i+1]||i==n-2)
		      {
		          div*=factorial[count];
		          div%=1000000007;
		          count=1;
		      }
		      
		  }
		  System.out.println(ans/div);
		}
	}
}

count variable should be declared as an int not long.
Array indices in java should be declared as int data type. For more information you can read about it here (10.4. Array Access)

Thank you , this really helped me :smiley: