Examples of remainder()


Examples of java.math.BigInteger.remainder()

        for (int i = 0; i < n; ++ i) {
            long a = in.nextInt();
            long b = in.nextInt();
            total = total.add(BigInteger.valueOf(a * b * 10000));
        }
        total = total.remainder(length);
        long result = total.longValue();
        result = Math.min(result, length.longValue() - result);
        out.printf("%d.%04d\n", result / 10000, result % 10000);
        out.flush();
    }
View Full Code Here

Examples of java.math.BigInteger.remainder()

            for (int i = 0; i < m; ++ i) {
                if ((mask >> i & 1) == 1) {
                    sum = sum.add(products[i].multiply(inverses[i]));
                }
            }
            sum = sum.remainder(base.multiply(BigInteger.valueOf(b)));
            if (sum.compareTo(base) >= 0) {
                result.add(sum);
            }
        }
        if (n == 1) {
View Full Code Here

Examples of java.math.BigInteger.remainder()

        }
        for (int i = 0; i < result.size(); ++ i) {
            BigInteger a = result.get(i);
            ArrayList <Integer> buffer = new ArrayList <Integer>();
            while (a.compareTo(BigInteger.ZERO) > 0) {
                buffer.add((int)a.remainder(BigInteger.valueOf(b)).longValue());
                a = a.divide(BigInteger.valueOf(b));
            }
            for (int j = n - 1; j >= 0; -- j) {
                int d = buffer.get(j);
                out.printf("%c", d < 10? '0' + d: 'A' + d - 10);
View Full Code Here

Examples of java.math.BigInteger.remainder()

    private static int calculateControlDigitMod8(BigInteger number)
    {

        BigInteger sum = calculateControlDigitSum(number);

        int rem = sum.remainder(BigInteger.valueOf(11)).intValue();

        if ((rem == 0) || (rem == 1)) {

            return 0;
        }
View Full Code Here

Examples of java.math.BigInteger.remainder()

     */
    public void setFractionalSecond(BigDecimal fractional) {
        calendarValue = null;
        second = fractional.intValue();
        BigInteger micros = fractional.movePointRight(6).toBigInteger();
        micros = micros.remainder(BigInteger.valueOf(1000000));
        microsecond = micros.intValue();
    }

    /**
     * <p>Return high order component for XML Schema 1.0 dateTime datatype field for
View Full Code Here

Examples of java.math.BigInteger.remainder()

     *                                  in <a href="#datetimefieldmapping">date/time field mapping table</a>.
     */
    public void setFractionalSecond(BigDecimal fractional) {
        second = fractional.intValue();
        BigInteger micros = fractional.movePointRight(6).toBigInteger();
        micros = micros.remainder(BigInteger.valueOf(1000000));
        microsecond = micros.intValue();
    }

    /**
     * <p>Return high order component for XML Schema 1.0 dateTime datatype field for
View Full Code Here

Examples of java.math.BigInteger.remainder()

                    }
                }
                if (!n.equals(MINUS_ONE))
                    for (int j = 0, size = array0 / d; j < size; j++) {
                        n = n.add(array[i]);
                        int p = intValue(n.remainder(array[0]));
                        if (!ns[p].equals(MINUS_ONE) && (ns[p].compareTo(n) < 0 || n.equals(MINUS_ONE)))
                            n = ns[p];
                        ns[p] = n;
                    }
            }
View Full Code Here

Examples of java.math.BigInteger.remainder()

    }

    private BigInteger generateR(BigInteger p, BigInteger q, BigInteger g,
                         BigInteger k) {
        BigInteger temp = g.modPow(k, p);
        return temp.remainder(q);
   }

    private BigInteger generateS(BigInteger x, BigInteger q,
            BigInteger r, BigInteger k) throws SignatureException {
View Full Code Here

Examples of java.math.BigInteger.remainder()

        BigInteger k1 = k.modInverse(q);

        BigInteger s = x.multiply(r);
        s = temp.add(s);
        s = k1.multiply(s);
        return s.remainder(q);
    }

    private BigInteger generateW(BigInteger p, BigInteger q,
                         BigInteger g, BigInteger s) {
        return s.modInverse(q);
View Full Code Here

Examples of java.math.BigInteger.remainder()

        BigInteger t1 = g.modPow(u1,p);
        BigInteger t2 = y.modPow(u2,p);
        BigInteger t3 = t1.multiply(t2);
        BigInteger t5 = t3.remainder(p);
        return t5.remainder(q);
    }

    /*
     * Please read bug report 4044247 for an alternative, faster,
     * NON-FIPS approved method to generate K
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.