public static double maxProfitJor(double[] prices) {
        double percentOriginal = 1;
        double lowestCurrent = prices[0];
        double highestCurrent = prices[0];
        for(int i=0; i < prices.length; i++) {
            if (prices[i] > highestCurrent && i < prices.length - 1) {
                highestCurrent = prices[i];
                continue;
            }

            percentOriginal = percentOriginal * (highestCurrent / lowestCurrent);
            if (prices[i] < lowestCurrent)
                lowestCurrent = prices[i];
            highestCurrent = prices[i];
        }
        if (prices[prices.length-1] > prices[prices.length-2]) {
            percentOriginal = percentOriginal * ((double)prices[prices.length-1] / (double)prices[prices.length-2]);
        }
        return percentOriginal;
    }