SORTING IN LINEAR TIME (error in funcction swap)

what is the error in the swap function?
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int i;
int a[]=new int[n];
for(i=0;i<n;i++)
{
a[i]=sc.nextInt();
}
int low=0,mid=0,high=n-1;
public static int(int l,int m)
{
int temp;
temp=m;
m=l;
l=temp;
return;
}
while(mid<=high)
{
switch(a[mid])
{
case 0 : swap(a[low],a[mid]);
low++;
mid++;

			case 1:     
			          mid++;      
			          break;
		    case 2:     
			
			            swap(a[mid],a[high]);  
			            high--;      
			            break;
	}
}		  

}
}

@akshay9009
Where have you wriiten swap function in your code.Please help me to find it.
Thankyou.

i have done the changes,thanks anyways

Hi Akshay,
If you don’t have any further doubts in this problem.
Then please resolve the doubt else you can ask the doubts anytime.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.