@Override
    @SuppressWarnings("unchecked")
    public List<Integer> sort(List<Integer> list) {

        // checking input parameter for null
        if (list == null) {
            throw new IllegalArgumentException("ArrayList not specified!");
        }

        // To get a digit we can first divide number with 10^i and then get the remainder
        // after dividing by 10, where i = 0 to 2*Number of digits in N;
        int exp = 1;

        // the number of digits in N^2 can be maximum double of the digits in N
        int maxDigits = 2;

        for (int i = 0; i < maxDigits; i++) {

            // initiating multidimensional list of lists of size 10
            List[] bucketList = new ArrayList[10];
            for (int k = 0; k < 10; k++) {
                bucketList[k] = new ArrayList<Integer>();
            }
            for (Integer aList : list) {
                int number = (aList / exp) % 10;
                bucketList[number].add(aList); // producing warning: unchecked assignment - suppressed.
            }
            exp *= 10;
            int index = 0;
            for (int k = 0; k < 10; k++) {
                for (Object num : bucketList[k]) {
                    list.set(index, (Integer) num);
                    index++;
                }
            }
        }
        return list;
    }