public static int maxProfitII(int[] prices) {
		if (prices.length <= 1) {
			return 0;
		}
		final int length = prices.length;
		int i = 0;
		int maxProfit = 0;
		while (i < length - 1) {
			int buy, sell;
			while (i + 1 <= length - 1 && prices[i + 1] <= prices[i]) {
				i++;
			}
			buy = i;
			while (i + 1 <= length - 1 && prices[i + 1] > prices[i]) {
				i++;
			}
			sell = i;
			maxProfit += prices[sell] - prices[buy];
		}
		return maxProfit;
	}