@@ -0,0 +1,1173 @@
+public class SubarraySum %7B%0A    /**%0A     * @param nums: A list of integers%0A     * @return: A list of integers includes the index of the first number %0A     *          and the index of the last number%0A     */%0A    public ArrayList%3CInteger%3E subarraySum(int%5B%5D nums) %7B%0A        ArrayList%3CInteger%3E res = new ArrayList%3CInteger%3E();%0A        if (nums == null %7C%7C nums.length == 0) %7B%0A            return res;%0A        %7D%0A        HashMap%3CInteger, Integer%3E map = new HashMap%3CInteger, Integer%3E();%0A        int sum = 0;%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            // get sum from 0 to i%0A            sum += nums%5Bi%5D;%0A            if (nums%5Bi%5D == 0) %7B%0A                res.add(i);%0A                res.add(i);%0A                return res;%0A            %7D%0A            if (sum == 0) %7B%0A                res.add(0);%0A                res.add(i);%0A                return res;%0A            %7D%0A            // if we find two sum have same value, we know sum from index q+1 to p is zero%0A            if (map.containsKey(sum)) %7B%0A                res.add(map.get(sum)+1);%0A                res.add(i);%0A                return res;%0A            %7D%0A            map.put(sum, i);%0A        %7D%0A        return res;%0A    %7D%0A%7D%0A

Create SubarraySum.java