To draw hash table using linear probing

JAVA Code

import java.io.*;
class hash
{
	public static void main(String args[]) throws Exception
	{
		int n=11,l,i,k,flag;
		int a[]=new int[11];
		int hash[]=new int[11];
	        BufferedReader cin= new BufferedReader (new InputStreamReader(System.in));
		System.out.println("Enter the elements ");
		for(i=0;i<n;i++)
		{
			a[i]= Integer.parseInt(cin.readLine());
			hash[i]=0;
		}
		for(i=0;i<n;i++)
		{
			k=(2*a[i]+5)%11;
			flag=0;
			while(flag!=1){
				if(hash[k]==0){
					hash[k]=a[i];
					flag=1;
				} 
				else
					k=(k+1)%11;//linear probing
			}
		}
		System.out.println("hash table is");
		for(i=0;i<n;i++){
			System.out.print(i+"\t");	
			System.out.println(hash[i]);	
		}
	}
}