public int maxProfit(int[] prices) {

		if (prices.length < 2) {
			return 0;
		}

		int[] profiles = new int[prices.length - 1];
		int i = 0;

		for (int j = 0; j < profiles.length; j++) {
			i = i + 1;
			int profile = prices[i] - prices[i - 1];
			profiles[j] = profile;
		}

		int sum = 0;
		for (int j = 0; j < profiles.length; j++) {
			if (profiles[j] >= 0)
				sum += profiles[j];
		}

		return sum;

	}