@@ -0,0 +1,1051 @@
+public class Solution %7B%0A    /**%0A     * @param nums: The rotated sorted array%0A     * @return: The recovered sorted array%0A     */%0A    public void recoverRotatedSortedArray(ArrayList%3CInteger%3E nums) %7B%0A    /** The key to the problem is to reverse the list in three steps. %0A     *  Take the example of %5B4, 5, 1, 2, 3%5D. %0A     *  Step 1: %5B4, 5%5D  -%3E %5B5, 4%5D%0A     *  Step 2: %5B1, 2, 3%5D -%3E %5B3, 2, 1%5D%0A     *  Step 3: %5B5, 4, 3, 2, 1%5D -%3E %5B1, 2, 3, 4, 5%5D%0A     */  %0A        if (nums == null %7C%7C nums.size() == 0) %7B%0A            return;%0A        %7D%0A        for (int i = 0; i %3C nums.size() - 1; i++) %7B%0A            if (nums.get(i) %3E nums.get(i + 1)) %7B%0A                reverse(nums, 0, i);%0A                reverse(nums, i+1, nums.size() - 1);%0A                reverse(nums, 0, nums.size() - 1);%0A            %7D%0A        %7D%0A    %7D%0A    %0A    private void reverse(ArrayList%3CInteger%3E nums, int start, int end) %7B%0A        for (int i = start, j = end; i %3C j; i++, j--) %7B%0A            int tmp = nums.get(i);%0A            nums.set(i,nums.get(j));%0A            nums.set(j, tmp);%0A        %7D%0A    %7D%0A%7D%0A

Create RecoverRotatedSortedArray.java