public String largestNumber(int[] nums) {
        Integer[] nums1 = new Integer[nums.length];
        int i = 0;
        for (int n : nums) {
            nums1[i++] = n;
        }

        IntegerComparator comparator = new IntegerComparator();
        Arrays.sort(nums1, comparator);
        StringBuffer buff = new StringBuffer();

        //handle 0s in the front by removing them.
        for (i = 0; i < nums1.length; i++) {
            if (nums1[i] != 0) {
                break;
            }
        }
        //if no element is left means return one 0
        if (i == nums1.length) {
            return "0";
        }
        for (;i < nums1.length; i++) {
            buff.append(nums1[i]);
        }
        return buff.toString();
    }
Given a list of non negative integers, arrange them such that they form the largest number.
For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.

https://leetcode.com/problems/largest-number/
src/com/interview/number/RearrangeNumberInArrayToFormLargestNumber.java