Doubt Counting Sort

Can you please tell me what is wrong with my code? it is only passing one test case.

import java.util.*;

public class Main {

public static void countSort(int []arr,int n,int max)
{
	int []count=new int[max+1];
	for(int i=0;i<n;i++)
	{
		count[arr[i]]++;
	}
	for(int i=1;i<=max;i++)
	{
		count[i]+=count[i-1];
	}
	int []output =new int[n+1];
	for(int i= n-1;i>=0;i--)
	{
		output[count[arr[i]]-1]=arr[i];
		count[arr[i]]--;
	}
	for(int i=0;i<n;i++)
	{
		arr[i]=output[i];
	}
	for(int i=0;i<n;i++)
	{
		System.out.print(arr[i]+" ");
	}
}
public static void main(String args[]) {
    Scanner sc=new Scanner(System.in);
	int n=sc.nextInt();
	int []arr=new int[n];
	for(int i=0;i<n;i++)
	{
		arr[i]=sc.nextInt();
	}
	int max=Integer.MIN_VALUE;
	for(int i=0;i<n;i++)
	{
		if(arr[i]>max)
		{
			max=arr[i];
		}
	}
	countSort(arr,n,max);
}

}

your output array creating got too clumsy which was creating problem for the larger test cases
use this simplifed way. added comments for easier understanding

I did not understand the problem in my code? I have followed the same logic as you and have also checked it with Geeks For Geeks. Please provide me with the proper java code for this problem so that I can check it for myself once.
I copied the GFG code to check but it is also not passing the test cases.
Here is the link https://www.geeksforgeeks.org/counting-sort/

please solve my query @aa1

yeah , for this problem there is some backend issue.
not sure till when it will be resolved, skip this for now, try to submit again after some time