public int maxProduct_easy_understand(int[] nums) {
        // write your code here
        if (nums.length == 0)
            return 0;
        if (nums.length == 1)
            return nums[0];
        int maxpre = nums[0], minpre = nums[0];
        int maxsofar = nums[0], maxhere = 0, minhere = 0;
        for (int i = 1; i < nums.length; ++i) {
            maxhere = Math.max(maxpre * nums[i], Math.max(minpre * nums[i], nums[i]));
            minhere = Math.min(maxpre * nums[i], Math.min(minpre * nums[i], nums[i]));
            maxsofar = Math.max(maxsofar, maxhere);
            maxpre = maxhere;
            minpre = minhere;
        }
        return maxsofar;
    }