class BucketSort {

    public int[] bucketSort(int[] array) {
        int[] bucket = new int[100];			// create an array the size of the largest value + 1

        // for every value in array, increment its corresponding bucket
        for (int i = 0; i < array.length; i++)
            bucket[array[i]]++;

        int outPos = 0;
        for (int i = 0; i < bucket.length; i++) { 
        	if (bucket[i] > 0)
            	array[outPos++] = i;
        }
        
        return array;
    }
    
    public static void  main(String args[]){
    	BucketSort bSort = new BucketSort();
    	int[] array = { 77, 99, 44, 55, 22, 88, 11, 0, 66, 33 };
    	int[] sortedArray = bSort.bucketSort(array);
    	for (int i = 0; i < array.length; i++)
        	System.out.println(sortedArray[i]);
    	
    }
}