public int  maxP(int[] A){
        int length = A.length;
        if(length == 1)
            return A[0];
        if(A== null || A.length ==0 )
            return 0;
        int max = A[0];

        int n = 0;
        int total = 1;
        int[] pre = new int[length];
        int[] aft = new int[length];
        for(int i = 0; i < length; i++){
            if(A[i] < 0)
                n++;
            total *= A[i];
        }
        pre[0] = 1;
        aft[length-1] = 1;
        for (int i = length-2; i >=0; i--){
            aft[i] = aft[i+1] * A[i+1];
            pre[length - i -1]  = pre[length-i - 2]* A[length-i-2];
        }
        if(n % 2 == 0)
            return total;
        else{
            for (int i = 0; i < A.length; i++){
                max = Math.max(max,Math.max(aft[i],pre[i]));
            }
            return max;
        }
    }