@@ -0,0 +1,844 @@
+package leetcode.summary_ranges;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class Solution %7B%0A    public List%3CString%3E summaryRanges(int%5B%5D nums) %7B%0A        List%3CString%3E ans = new ArrayList%3CString%3E();%0A        if(nums == null %7C%7C nums.length == 0) return ans;%0A        int from = nums%5B0%5D, cur = nums%5B0%5D;%0A        for(int i = 1; i %3C nums.length; i++)%7B%0A            if(nums%5Bi%5D == cur + 1)%7B%0A                cur = nums%5Bi%5D;%0A            %7Delse%7B%0A                if(from == cur)%7B%0A                    ans.add(Integer.toString(cur));%0A                %7Delse%7B%0A                    ans.add(from + %22-%3E%22 + cur);%0A                %7D%0A                from = cur = nums%5Bi%5D;%0A            %7D%0A        %7D%0A        if(from == cur)%7B%0A            ans.add(Integer.toString(cur));%0A        %7Delse%7B%0A            ans.add(from + %22-%3E%22 + cur);%0A        %7D%0A        return ans;%0A    %7D%0A%7D%0A

Add java solution for 228. Summary Ranges