I need to make a code that will count all the instances of 1 number in an array. Here is what I have so far:

Code:
public class NumOccurrences 
{
    public static int num (int[] a,int i)
    {
        int count = 0;
        a = new int [6];
        for (int j = 0; j < a.length; j++ )
        {
            if (a[0] == j)
                count++;
            
                
        
                
        }        
         return count;
                
        }
    }
2 out of my 5 tests pass, and I'm not sure what I am doing wrong, can someone point me in the right direction?