* @param result0
     * @param rootRoundIfNecessary
     * @param epsilon
     * @param maxite
     * @param decimalPlaces
     * @param a_RoundingMode
     * @return Re-approximation of result0 using Newton Raphson method
     */
    private static BigDecimal newtonRaphson(
            BigDecimal x,
            BigDecimal result0,
            BigInteger root,
            BigDecimal epsilon,
            //int maxite,
            int decimalPlaces) {
//            RoundingMode a_RoundingMode) {
        RoundingMode a_RoundingMode;
        if (x.compareTo(BigDecimal.ONE) == 1) {
            a_RoundingMode = RoundingMode.DOWN;
        } else {
            a_RoundingMode = RoundingMode.UP;
        }
        BigDecimal result = new BigDecimal(result0.toString());
        BigDecimal root_BigDecimal = new BigDecimal(root);
        int magnitudex = magnitude(x);
        //System.out.println("magnitudex " + magnitudex);
        int precision = decimalPlaces + 5;
        int divprecision = decimalPlaces + 10;

        MathContext a_MathContext = new MathContext(precision);
        BigDecimal previousResult_BigDecimal;
//        BigDecimal previousResult_BigDecimal0;
        BigDecimal resultipowroot;
        BigDecimal resultipowrootsubtract1;
        BigDecimal divisor;
        BigInteger rootsubtract1 = root.subtract(BigInteger.ONE);

        boolean maxiteReached = true;
        //resultipowroot = toCompare.pow(rootRoundIfNecessary, a_MathContext);
        //resultipowrootsubtract1 = toCompare.pow(rootRoundIfNecessary - 1, a_MathContext);
        //divisor = root_BigDecimal.multiply(resultipowrootsubtract1, a_MathContext);

        // Initialise toCompare and previousResult_BigDecimal
        previousResult_BigDecimal = new BigDecimal("1");
//        previousResult_BigDecimal0 = new BigDecimal("1");

        // Newton Raphson
        while (true) {
            //for (int i = 0; i < maxite; i++) {
            resultipowroot = power(
                    result,
                    root,
                    64,
                    precision,
                    a_RoundingMode);
            resultipowrootsubtract1 = power(
                    result,
                    rootsubtract1,
                    64,
                    precision,
                    a_RoundingMode);
            divisor = resultipowrootsubtract1.multiply(root_BigDecimal);
            result = result.subtract(
                    Generic_BigDecimal.divideNoCaseCheckRoundIfNecessary(
                    resultipowroot.subtract(x),
                    divisor,
                    divprecision,
                    a_RoundingMode));
//            result = result.subtract(
//                    resultipowroot.subtract(x).divide(divisor, a_MathContext));
            // Test for convergence
            if ((previousResult_BigDecimal.subtract(result)).abs().compareTo(epsilon) != 1) {
                //System.out.println("Root found in iteration " + i + " out of " + maxite);
                maxiteReached = false;
                break;
            }
            //System.out.println(result.toPlainString());
//            previousResult_BigDecimal0 = new BigDecimal(previousResult_BigDecimal.toString());
            previousResult_BigDecimal = new BigDecimal(result.toString());
        }