public void sort (int[] a){
        if (a==null || a.length<=1){
            return;
        }

        int max = a[0];
        for (int i=1; i<a.length; i++){
            max = Math.max(max, a[i]);
        }

        int ten=1;
        int[] aux = new int[a.length];
        int [] count = new int[10];
        while (ten<=max){
            for (int i=0; i<a.length; i++){
                count[(a[i]/ten)%10]++;
            }
            for (int i=1; i<count.length; i++){
                count[i]+=count[i-1];
            }
            for (int i=a.length-1; i>=0; i--){
                aux[--count[(a[i]/ten)%10]] = a[i];
            }

            for (int i=0; i<a.length; i++){
                a[i] = aux[i];
            }

            for (int i=0; i<count.length; i++){
                count[i]=0;
            }
            ten*=10;
        }

    }